我正在設置一個UILocalNotification來通知用戶有關事件。iOS模擬器在設置UILocalNotification並關閉應用程序時崩潰
我的問題是在設置通知並關閉應用程序後,模擬器崩潰並顯示消息「線程1:信號SIGKILL」。
我知道this答案,但我沒有在userinfo字典中存儲任何東西。
下面的代碼:
NSDate *alertTime = [[NSDate date]
dateByAddingTimeInterval:10];
UIApplication* app = [UIApplication sharedApplication];
UILocalNotification* notifyAlarm = [[UILocalNotification alloc] init];
if (notifyAlarm)
{
notifyAlarm.fireDate = alertTime;
notifyAlarm.timeZone = [NSTimeZone defaultTimeZone];
notifyAlarm.repeatInterval = 0;
notifyAlarm.alertBody = @"Testing notification.";
[app scheduleLocalNotification:notifyAlarm];
NSLog(@"Notification set");
}
你有任何想法,爲什麼這可能發生?
謝謝
你能發表相關的方法或代碼嗎? –
我已經爲你更新了我的問題。 – JakesRassie
將代碼粘貼到收到通知的地方 –