Handling Push Notifications when App is Terminated

后端 未结 7 616
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-30 03:55

When my App is not running and receives a Push Notification, if I click on that notification, the App is launched - but then it doesn\'t prompt the user with the Alert-View

7条回答
  •  迷失自我
    2020-11-30 04:28

    The app does not process push notification in the background, what it really does the OS is wake up the app once you press in the notification. You can catch this moment in the following way:

        - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
        { 
    
            if ([launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]) {
          // Your app has been awoken by a notification...
            }
       }
    

提交回复
热议问题