Take the 2-minute tour ×

I see iOS applications like Facebook that send notifications even if the application hasn't been launched.

I need to schedule a task with a timer that gets executed at every time interval, and this task (should be inside the same application) should deliver a NSUserNotification if meets some conditions.

How can you set up such a notification even if the application isn't running?

share|improve this question

3 Answers 3

up vote 7 down vote accepted

Facebook app and other apps that send notifications when they were not launched do this by using the remote notification mechanism.

To use this, you need to setup a server, create push certificates and use a APNS library for your preferred server.

Take a look here for details: http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12

share|improve this answer

Scheduled notifications can be done with local notifications, using UILocalNotification. However, like push notifications, local notifications cannot run code. They present a notification to the user, who may or may not choose to start your app in response.

If you want to run code in your app on a timed schedule, then your app has to run in the background. And Apple limits background apps to only a few specific purposes. If your app doesn't fall in one of those categories your app can't run in the background (see UIBackgroundModes key).

Significant location change monitoring can start you app when a location change has occurred but that is location based not time based and cannot be scheduled.

share|improve this answer

It cannot be done in the way you think, you (like Facebook) should use Apple Push Notification Service.

share|improve this answer

Your Answer


