0
我有一個由主線程啓動的計時器。來自定時器處理程序我正在發送通知 在5個案例中的1箇中,當執行發佈通知代碼時,我得到EXC_BAD_ACCESS。發送來自定時器處理程序的通知cocoa
//Registering Notification
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(TestNotification:)
name:@"TestNotification" object:nil];
//Starting timer
timer = [NSTimer scheduledTimerWithTimeInterval:2
target:self
selector:@selector(timerhandler:)
userInfo:nil
repeats:YES];
//Posting notification from timer handler
[[NSNotificationCenter defaultCenter]
postNotificationName:@"TestNotification" object:nil];
有人可以幫忙。
感謝
請發佈'TestNotification:'方法。問題很可能在那裏。 – spudwaffle 2012-01-13 16:57:52