且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

应用程序未运行时处理推送通知(即完全被杀死)

更新时间:2022-12-27 10:56:08

当应用程序被完全杀死时获取通知代码

When application is totally killed get notification code

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
if (launchOptions != nil)
{
     //opened from a push notification when the app is closed
    NSDictionary* userInfo = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
    if (userInfo != nil)
    {
         NSLog(@"userInfo->%@",[userInfo objectForKey:@"aps"]);
         //write you push handle code here

    }

}
}

欲了解更多信息,请访问以下链接:在应用程序终止时处理推送通知

For more go through this link: Handling Push Notifications when App is Terminated