iOS 推送小记

ios做推送功能时,最烦得就是各种证书的问题,以前自己做的时候经常要反复搞那些证书搞好几遍才能成功,现在发现归根到底都是appid这个东西搞错了,做个笔记记下来,以免忘了。

首先是程序里面注册推送的变化,ios8之后改了注册方法,用此方法注册

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)

    {

        [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings

                                                                             settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge)

                                                                             categories:nil]];

        

        

        [[UIApplication sharedApplication] registerForRemoteNotifications];

    }

 

推送证书请求:把plist里面bundel indenfier 改掉,不能用原来的名字,原来名字是通配的bundel id ,通配的bundel id 不能做推送证书请求,同时将项目设置里面的general 里面的bundel id 改成与plist里面一致。用此appid申请appid同时在severs里面将push servers勾上,然后制作两个Apple Push Notification service SSL (Sandbox),然后制作两个对应的provising profile 文件,调试的时候选择相应的调试用的证书和profile文件。(只是我的个人情况做个总结,每个人遇到的问题不同,遇到问题多查资料,多测试,就能找到适合自己的方法)

posted @ 2014-12-17 14:52  Dr.cyc  阅读(177)  评论(0编辑  收藏  举报