May i know, how to open an ios application, on tapping on notification. Or when we swipe an icon (in case when iphone is locked.) of notification?
Can anyone please help me out here?
May i know, how to open an ios application, on tapping on notification. Or when we swipe an icon (in case when iphone is locked.) of notification?
Can anyone please help me out here?
The OS handles the behavior when tapping the notification as it comes in. Doesn't matter if it is sent by a 3rd party or not, if it is going through APNS, it will open the application and inside applicationDidFinishLaunchingWithOptions:(NSDictionary *)launchOptions
:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
if (launchOptions != nil) {
// Launched from push notification
NSDictionary *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
}
}
If the app happens to be already open when the notification comes in the OS will fire the delegate method:
- (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
// Do something
}
It's automatically open the app. Apple do the stuff for us. We don't need to code anything for open the app.
The app is opened automatically, but the last view controller you were in. So in order to open you desired view controller just implement application:didReceiveRemoteNotification: Further explanation here.
On pressing the local notification, app launches automatically.