6

I want to keep the app from opening when user taps a push notification. How can I do this?

Here's what I have:

- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

    NSDictionary *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
    if (notification != NULL){
            // write code something like doesn't open app.
     }
}
rebello95
  • 8,486
  • 5
  • 44
  • 65
nobinobiru
  • 792
  • 12
  • 28

2 Answers2

13

It is not possible.We get control at our side after launching the app.

Dheeraj Kumar
  • 490
  • 3
  • 12
7

@dheeraj-kumar is right.

  1. You can't prevent the app from opening, it's up to the OS
  2. Trying to prevent an app from opening is almost certainly against Apple guidelines and is very likely to result in your app getting rejected
  3. Why would you want to prevent a user from opening your app through a push notification? The reason you sent them the notification to begin with was so they know they need to check something in the app, isn't it?
rebello95
  • 8,486
  • 5
  • 44
  • 65