How to disable app opening when user clicks push notification

I want to prevent the app from opening when the user removes the 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.



source to share

2 answers

It's impossible. We get control on our side after launching the application.



@ dheeraj-kumar is right.

  • You cannot prevent the application from being opened, it's up to the OS
  • Trying to prevent the app from opening is almost certainly in relation to Apple's guidelines and will most likely result in your app crashing.
  • Why do you want to prevent the user from opening the app via push notification? The reason you sent them a notification is to start by letting them know they need to check something in the app, right?


All Articles