I've read all of the possible solutions on stack overflow but not one works for me.
My code is
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)
}
And in another class I've:
NotificationCenter.default.post(name: NSNotification.Name.init("dbReady"), object: dictionary)
All of syntax for selector doesn't work
I tried:
1. fetchedUser
2. fetchedUser:
3. fetchedUser(notification:)
4. "fetchedUser:"
And other ten options maybe. Can anyone help me?
My error was a selector with name didn't exist "fetchedUserWithNotification:". I solved my problem by rewriting a new class and copy and paste all its content. Maybe it was a Xcode bug (IMHO the last version is plenty of it )