Houman
Houman

Reputation: 66320

How to cancel all UILocalNotification, if the user got reminded x many times?

I have a situation with UILocalNotification. I know there is an answer how to cancel a uilocalnotification

My scenario is though:

Reading the document it says there is this one method that is called when the app is running: application:didReceiveLocalNotification:. But this is only hit if the app is running at the time of event. What if the user doesn't come back?

Is there anyway my app could cancel all events after a certain number of inactive days have passed? I don't want to keep pestering the user, if there is no interest after all.

Upvotes: 0

Views: 106

Answers (1)

Grzegorz Krukowski
Grzegorz Krukowski

Reputation: 19802

The only way is to setup all local notifications when you go to background. So you same notification several times with different date - each of them are single notification (non repeated).

  • after 1 day
  • after 2 days
  • after 3 days
  • after 6 days

Each time user opens you up you clean all of them with "cancelAllLocalNotifications" - each time he goes to background you create them all.

Upvotes: 2

Related Questions