`
stephen830
  • 浏览: 2965185 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

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

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics