IOS Cancel local notifications

I do not like to ask vague questions, but I could not say exactly what the problem was.

In my application, I set daily local notifications. Shooting every day at 200 pm. Later, I removed the codes that set local notifications and added a push notification function.

I am testing push and it works (whenever I want). But I still get old notifications, maybe because I put them earlier somewhere on the phone. Is there any way to cancel them without encoding. For example, are they canceled if I delete the application?

+6
source share
1 answer

Removing the application will delete local notifications, although some people have reported that they are cached for 24 hours (so if you uninstall the application, do not reinstall it for more than 24 hours) See here for more details.

Otherwise, if you still have access to the code, you can cancel all local notifications, for example:

[[UIApplication sharedApplication] cancelAllLocalNotifications]; 
+18
source

Source: https://habr.com/ru/post/952070/


All Articles