我正在使用NSNotificationCenter订阅活动
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(useNotificationWithLocation:)
name:@"somename"
object:nil];
从静态库发送,
[[NSNotificationCenter defaultCenter] postNotificationName:@"somename" object:nil userInfo:dictionary];
一切都按预期工作,但当我使用任何UI事件时,如按钮点击,我停止获取通知。我不知道发生了什么。
useNotificationWithLocation code,
-(void)useNotificationWithLocation:(NSNotification*)value
{
NSDictionary* dictionary = value.userInfo;
CLLocation *currentLoc = [dictionary valueForKey:CURRENT_LOCATION_NOTIFY];
NSLog(@"useNotificationWithLocation %@",currentLoc);
}
请建议我该怎么做。