简体   繁体   中英

iOS UILocalNotification not updating app icon

first of all, I'm really thankful for all your help.

I need just one more little help.

I finished my app, and I used UILocalNotifications to fire some reminders. The app icon is always with a "1" saying there is 1 new notification on the app but it is like that for ever, even if there is no notification. How can I fix this?

Other detail, when the user slides the app icon when iPhone fires the notification (outside the app when the iPhone is locked or when the app is in the background), I would like the app to load in the main view. Is it possible?

You can reset the badge number inside you application delegate code, in didFinishLaunchingWithOptions and didReceiveLocalNotification: as appropriate. ie

   [[UIApplication sharedApplication] setApplicationIconBadgeNumber: 0];

I don't understand your second question. If you want to change the view it displays depending upon how its launched then you can do so, once again this would be in didFinishLaunchingWithOptions or didReceiveLocalNotification.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM