PJR PJR - 5 months ago 11
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

You can cancel all notifications with :

[[UIApplication sharedApplication] cancelAllLocalNotifications];

or you can cancel a single one like :

[[UIApplication sharedApplication] cancelLocalNotification:theNotification];

Hope this helps.

Comments