Reputation: 2317
I am implementing Push Notification in my app, and everything works just fine when the app is open: when a Notification is received, my method [self processRemoteNotification:pushNotification]
fires off as expected.
Now I want the same method to be called, when the app is receiving a remote notification, when it is NOT running.
For that, I have the following code:
- (BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSDictionary* pushNotification =
[launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if (pushNotification) {
[self processRemoteNotification:pushNotification];
}
return YES;
}
I'm not really sure how to test this though.
What I did is
In the above method, I have put a break point. Somehow, the condition if (pushNotification)
is not met, and my [self processRemoteNotification:pushNotification]
is not fired.
What am I doing wrong?
Upvotes: 0
Views: 418
Reputation: 15213
You need to start the app by sliding the notification from left to right on the lock screen or from the notification centre.
Upvotes: 1