Hesham
Hesham

Reputation: 5274

Taking action on app start up based on Push Notification

I have push notifications enabled for my app and I detect whether the app is opened from a push notification or not on didFinishLaunchingWithOptions

I want to take action based on the push notification that the user has opened the app from. So for example if the notification says "Someone has added you to their friends", opening the app from that notification would take the user to that other user's profile.

How can I achieve this?

Upvotes: 1

Views: 2903

Answers (1)

Furkan Mustafa
Furkan Mustafa

Reputation: 794

on application:didFinishLaunchingWithOptions: method;

NSDictionary *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if (notification) {
    // do something with notification
}

Upvotes: 9

Related Questions