简体   繁体   English

当应用程序处于非活动状态时处理Apple Push Notification

[英]Handling Apple Push Notification when app is inactive

I wonder how lookout www.lookout.com implement there scream functionality on ios. 我不知道监视www.lookout.com如何在ios上实现尖叫功能。 Since when the app is in inactive mode(The user pressed home button) , there's no way to handle the notification (since didReceiveRemoteNotification is not called ). 由于当应用程序处于非活动模式(用户按下主页按钮)时,无法处理通知(因为未调用didReceiveRemoteNotification)。 So how did they make the phone scream when receiving notification unless customizing the alert sound but I don't think that is the case. 因此,除非自定义警报声音,否则他们如何在接收通知时使电话尖叫,但我认为情况并非如此。 Any ideas? 有任何想法吗?

You can override the method : 您可以覆盖方法:

  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
   if (launchOptions != nil) {
       apnsDict=[launchOptions objectForKey:@"UIApplicationLaunchOptionsRemoteNotificationKey"];
    //handle more here
    }
}

If you have received any notification while your app was inactive, you will get this condition true in this method whenever you will open your application. 如果您在应用程序处于非活动状态时收到任何通知,则无论何时打开应用程序,都将通过这种方法使此条件成立。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM