iphone notification results in “unrecognized selector sent to instance…”

前端 未结 1 884
我在风中等你
我在风中等你 2021-02-13 10:43

To make it short, I\'m registering the following NSNotification listener in ClassA (in viewDidLoad):

[[NSNotificationCente         


        
相关标签:
1条回答
  • 2021-02-13 11:26

    Your @selector needs a : character if it is to take an argument:

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playSong:) name:@"playNotification" object:nil];
    

    Instances of ClassA do not respond to the playSong selector, but they do respond to the playSong: selector.

    0 讨论(0)
提交回复
热议问题