1

I am implementing an app where I set a local notification for a particular time. When that notification is fired I want to set the next notification based on a date from my database for execution. How can I accomplish this in iOS.

I have tried to find different way of doing this but I am not able to figure it out yet. Here are the issues that I am facing.

  1. Can I get a callback when the local notification is fired irrespective of user action ?
  2. Can I perform background execution at a specific time ? How ?

Is there anything else that I can use?

Smita Ahinave
  • 1,901
  • 7
  • 23
  • 42
Bvit
  • 11
  • 2

2 Answers2

0

If the app is in foreground, you can set next notification in didReceiveLocalNotification method in AppDelegate

When app is not running, you can only get callback if user clicks the notification and application has launched.

Here is a good tutorial for local notifications, you can follow

Charmi Gheewala
  • 818
  • 7
  • 9
0

You should set all the Local Notifications you want when the app will enter in background. There is no reason to set the next one when a notification is fired.

Use a for(), append the gap you want to the previous NSDate and set all the Local Notifications when the app will enter in background. When the app did become active use [[UIApplication sharedApplication] cancelAllLocalNotifications];

Ciprian C
  • 247
  • 1
  • 6