user471416
user471416

Reputation:

local Notification + run specific function

I want to do specific job when app notify means instead of show alert run specific function

is it possible ?

Upvotes: 0

Views: 1092

Answers (2)

alones
alones

Reputation: 2894

From iOS 4.0

You can handle a local notification like handling push notification.

When the app is launching by tapping the local notification alert view (naturally the app should be ended before).

In the following method,

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

please do the following code

NSDictionary* dictionary = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
NSLog("%@", dictionary);

Upvotes: 0

Kris Markel
Kris Markel

Reputation: 12112

In a word: No. Local notifications are intended to alert the user at a specific time. They only way to run code in your application based on a notification is if the user interacts with the notification in such a way that starts your app, usually by clicking the action (or "view") button.

More details can be found under "Handling Local and Remote Notifications" in the Local and Push Notification Programming Guide.

Upvotes: 2

Related Questions