NSNotification postNotificationName in AppDelegate but NSNotificationCenter in ViewController?

后端 未结 3 834
爱一瞬间的悲伤
爱一瞬间的悲伤 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 05:57

    That looks like it should work, as long as the value of ChatMessageReceived is the same in both instances.

    Have you used the debugger to verify that the init method in the view controller file is called before the notification is posted in didReceiveMessage?

提交回复
热议问题