Vikram Parimi
Vikram Parimi

Reputation: 777

How to avoid duplicate notifications in iOS?

My app shows up a local notification when the user disables the Wifi from iOS system settings. But it shows 'n' number of notifications if the user turns on and off the Wifi for 'n' number of times.

I would like to show the new notification only when the previous notification was cleared or user taps on the same to launch the app.

How can i achieve this?

Thanks in Advance.

Upvotes: 0

Views: 1800

Answers (1)

Muhammad Umair
Muhammad Umair

Reputation: 593

You should call [[UIApplication sharedApplication] cancelLocalNotification:notification] before scheduling a new notification. It will cancel your notifications and user will receive only one notification.

For more check this.

Upvotes: 1

Related Questions