在执行方法时的类中,我放置了以下内容:
[[NSNotificationCenter defaultCenter] postNotificationName:@"locationFromZipFound" object:array];
在我希望收到通知的类(class)中,我有以下内容:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(getZipLocation:)
name:@"locationFromZipFound"
object:nil];
问题是,这从未被调用过:
-(void)getZipLocation:(NSNotification *)notification; {
NSLog(@"Zip received and put into array!");
NSArray *location = [notification object];
}
有什么想法吗? 提前致谢。
最佳答案
没关系!我试图在一种方法中注册通知,但似乎不喜欢那样。我刚刚在 viewDidLoad
中注册了通知,一切似乎都很好!
关于iphone - 未调用通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4479008/