NSNotification postNotificationName in AppDelegate but NSNotificationCenter in ViewController?

后端 未结 3 847
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-07 05:48

I can\'t get the selector method, receiveChatText, in the NSNotificationCenter to execute and I am wondering if the problem is because the NSNotification postNotificationNam

3条回答
  •  遥遥无期
    2021-01-07 06:12

    +defaultCenter is a class method on NSNotificationCenter which will return the same NSNotificationCenter instance every time it is called in a given process regardless of where you call it from.

    How is 'ChatMessageReceived' defined? It should be a NSString but is the name 'ChatMessageReceived' a valid symbol in the context of both of your classes?

提交回复
热议问题