码迷,mamicode.com
首页 > 其他好文 > 详细

推送消息,程序正在运行的时候弹出弹框问题解决

时间:2016-01-19 14:08:16      阅读:120      评论:0      收藏:0      [点我收藏+]

标签:

在这个方法里面处理获取的远程推送消息

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler

{

 // 取得 APNs 标准信息内容

    NSDictionary *aps = [userInfo valueForKey:@"aps"];

    NSString *content = [aps valueForKey:@"alert"]; //推送显示的内容

       if (content.length != 0) {

         if ([userInfo valueForKey:@"webUrl"])

        {

            webUrl = [userInfo valueForKey:@"webUrl"];            

            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil

                                                            message:content

                                                           delegate:self

                                                  cancelButtonTitle:@"取消"

                                                  otherButtonTitles: @"去看看",nil];

            alert.tag = 10000;

            [alert show];

            

        }

        else

        {

            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil

                                                            message:content

                                                           delegate:nil

                                                  cancelButtonTitle:@"知道了"

                                                  otherButtonTitles: nil];

            [alert show];

        }

    }

 }

 

注:有网页跳转带到网页

推送消息,程序正在运行的时候弹出弹框问题解决

标签:

原文地址:http://www.cnblogs.com/angongIT/p/5141786.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!