atlas
atlas

Reputation: 411

Can't get rid of scheduled push notifications - iOS

I have a very silly problem, which I unfortunately don't really understand how to solve.

I'm trying to implement push notification to my iOS app (Swift). I did succeed to create scheduled push notifications, where I send a notification every minute, for test purposes. Now I don't seem to be able to remove this, even though I have removed the code related to it, and reinstalled the app on the device. The only thing working is to disable push notifications in Xcode, which I do not want to do. It seems like I have missed something fundamental about the concept.

I did use an APN Tester at first to send messages to the device, but I don't think that has to do with anything.

Silly question, but I hope someone could help me. Thanks!

Upvotes: 1

Views: 74

Answers (2)

D. Pratt
D. Pratt

Reputation: 464

Updating Lumialxk to be current as of Swift 4.0 using UNUserNotificationCenter

UNUserNotificationCenter.current().removeAllPendingNotificationRequests()

Upvotes: 0

Lumialxk
Lumialxk

Reputation: 6369

Use this to remove all local notification:

UIApplication.sharedApplication().cancelAllLocalNotifications()

Upvotes: 2

Related Questions