Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift 为什么此行NSNotificationCenter.defaultCenter().postNotificationName(…)抛出SIGABRT_Swift_Nsnotificationcenter_Xcode6 - Fatal编程技术网

Swift 为什么此行NSNotificationCenter.defaultCenter().postNotificationName(…)抛出SIGABRT

Swift 为什么此行NSNotificationCenter.defaultCenter().postNotificationName(…)抛出SIGABRT,swift,nsnotificationcenter,xcode6,Swift,Nsnotificationcenter,Xcode6,我在斯威夫特的NSNotificationCenter玩。这是我在main.swift中的代码 进口基金会 class T: NSObject { func someAction(notification: NSNotification) { println(notification.userInfo) } } var dataDict = Dictionary<String, String>() dataDict["test"] = "test"

我在斯威夫特的NSNotificationCenter玩。这是我在
main.swift中的代码

进口基金会

class T: NSObject {

    func someAction(notification: NSNotification) {
        println(notification.userInfo)
    }
}

var dataDict = Dictionary<String, String>()
dataDict["test"] = "test"
dataDict["test1"] = "test1"


var t = T();
NSNotificationCenter.defaultCenter().addObserver(t, selector:"someAction", name: "someAction", object:nil)



NSNotificationCenter.defaultCenter().postNotificationName("someAction", object:nil, userInfo:dataDict)

let runloop = NSRunLoop.currentRunLoop();
runloop.run();

println("Done");
当我尝试检查该实例时,我得到以下结果:

(lldb) po 0x1005005a0
4300211616
看起来变量已经超出了范围。这是一个正确的结论吗


上面的代码有什么问题?

选择器应该是
someAction:
而不是
someAction
,因为它只有一个参数。

谢谢您的快速回答!它起作用了。那么,我应该如何解释po输出?实例没有超出范围吗?
(lldb) po 0x1005005a0
4300211616