我已经阅读了所有堆栈溢出的可能解决方案,但没有一个适用于我。无法识别的选择器NotificationCenter Swift 3
我的代码是
NotificationCenter.default.addObserver(self, selector: #selector(fetchedUser(notification:)) , name: NSNotification.Name.init("dbReady"), object: nil)
loggedUser.fetchUserByUID(id: current.uid)
return true
}
func fetchedUser(notification:NSNotification){
let info = notification.object as! [String : AnyObject]
print(info)
}
,并在另一个类中我有:
NotificationCenter.default.post(name: NSNotification.Name.init("dbReady"), object: dictionary)
所有语法选择不工作
我想:
- fetchedUser
- fetchedUser:
- fetchedUser(通知:)
- “fetchedUser:”
等10个可能。这个问题让我疯狂!
任何人都可以帮助我吗?
它给你编译器错误? –
[你也读过他的吗?](http://stackoverflow.com/a/40757389/5099208) – Idan
一个独立的示例:http://stackoverflow.com/questions/39351781/swift-2-0-到SWIFT-3-0-nsnotification通知。 –