UILocalNotification crashes my application when I start it

喜欢而已 提交于 2019-12-12 05:20:51

问题


I can enable an UILocalNotification in my application, I proceed like this:

in my UIViewController

if(_endDate){    
        UILocalNotification *localNotif = [[UILocalNotification alloc] init];
        if (localNotif == nil)
            return;
        localNotif.fireDate = _endDate;
        localNotif.timeZone = [NSTimeZone defaultTimeZone];

        localNotif.alertBody = @"go";
        localNotif.soundName = UILocalNotificationDefaultSoundName;
        localNotif.applicationIconBadgeNumber = 1;

        [[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
    }

in Appdelegate:

-(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification{
    application.applicationIconBadgeNumber = 0;
}

When the notification appears, I launch the app, I enter into the delegate correctly but after that, the application crash.

I work in IO6

Can you help me ?


回答1:


for fineding creash you can do this following step for profile project like:-

in Xcode-->Product-->choose profile.

wait till project runs in instruction Zombies. press on Profile you found your simulator as normal run. when your app Cresh you just select consol like:-

you found where is crash log with variable hope you got it



来源:https://stackoverflow.com/questions/15109257/uilocalnotification-crashes-my-application-when-i-start-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!