当前位置: 代码迷 >> Iphone >> iphone收到推送讯息的处理
  详细解决方案

iphone收到推送讯息的处理

热度:22   发布时间:2016-04-25 06:16:33.0
iphone收到推送消息的处理

?

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);}
?

?

?

?

  相关解决方案