iOS干货程序员iOS && Android

iOS 接入极光推送

2016-02-29  本文已影响1232人  any_where

一、推送证书的制作

①创建一个推送的APPID

1.选择identifiers -> app ids

2.填写描述

3.Bundle ID(域名的反写)

4.勾选"Push Notifications"

5.点击上面的继续,可以看到下面的信息

6.成功创建APPID

②根据刚才新建的APPID ,制作APNS开发环境证书

1.选择certificates->development -> add新建

2.选择

3.选择APPID(自己新建的用于推送的APPID)

4.选取CSR上传(具体百度一下)

5.开发环境的推送证书制作完成

③、开发环境描述文件的制作(根据推送的APPID)

1.还是『+』

2.选择开发环境

3.选择APPID

4.选择开发者

5选择需要安装的设备

6.起个名字,制作完成

④、推送的.p12制作

选中上面的push service ,导出,把这个.p12上传到极光的服务器

二、极光推送的接入

附地址极光推送文档

1.在- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions方法中注册极光推送时,

#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_7_1

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

[JPUSHService registerForRemoteNotificationTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil];

}else{

[JPUSHService registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound categories:nil];

}

#else

[JPUSHService registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound categories:nil];

#endif

[JPUSHService setupWithOption:launchOptions appKey:BFY_JPush_APP_Key channel:BFY_JPush_Channle apsForProduction:NO];

这样可以是iPhone4 7.1可以接受推送

上一篇 下一篇

猜你喜欢

热点阅读