PJR PJR - 2 years ago 67
Objective-C Question

Stop Local Notification when application removed from background

I am using Local notification in my application. Now if i remove my application from background then the notification is active. , i want to remove or cancel notifications whenf i remove app from background.

i write code for cancelation in applicationWillTerminate method but this method is not calling .
any other help ?

Answer Source

You can cancel all notifications with :

[[UIApplication sharedApplication] cancelAllLocalNotifications];

or you can cancel a single one like :

[[UIApplication sharedApplication] cancelLocalNotification:theNotification];

Hope this helps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download