我已经阅读了有关堆栈溢出的所有可能解决方案,但没有一个适合我。
我的代码是
func foo() {
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)
选择器的所有语法都不起作用
我试过了:
1. fetchedUser
2. fetchedUser:
3. fetchedUser(notification:)
4. "fetchedUser:"
可能还有其他十个选项。谁能帮我?