?
iphone收到推送消息的处理
?
(1)app应用没有运行,则在方法didFinishLaunchingWithOptions中进行调用.
?
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ //判断程序是不是由推送服务完成的 if (launchOptions) { //截取apns推送的消息 NSDictionary* pushInfo = [launchOptions objectForKey:@"UIApplicationLaunchOptionsRemoteNotificationKey"]; //获取推送详情 NSString *pushInfo = [[NSString stringWithFormat:@"%@",[pushInfo objectForKey:@"aps"]]; } }?
?
?
(2)app已经运行(或者被切换至后台),则在方法didReceiveRemoteNotification中进行调用。
?
?
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { NSLog(@"userInfo=%@",userInfo);}?
?
?
?