在执行方法时的类中,我放了这个:
[[NSNotificationCenter defaultCenter] postNotificationName:@"locationFromZipFound" object:array];
在我希望收到通知的课堂上,我有这个:
[[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];
}
有任何想法吗?提前致谢。