1. 生成CSR文件
生成Certificate Signing Request(CSR)

填写你的邮箱(这个邮箱是申请AppID的付费帐号)和常用名称(一般默认是计算机名,不用更改),并选择保存到硬盘:

点击继续:

已经在本地生成了一个TXIMDemoAPS.certSigningRequest的CSR文件。
2. 生成 App ID
登录developer.apple.com,选择Member Center :

进入后选择Certificates, Identifiers & Profiles:

再选择Identifiers进行到Identifiers管理页:

生成App ID:
Identifiers的右侧列表中,如果你已经配置你的应用,跳到第3步,否则点击“+”号添加Appid。

输入你的App ID描述信息,可以输入工程名; Bunble ID(在工程的General信息中),一般格式为com.youcompany.youprojname, 选择需要支持Push Notification,Continue:

Submit提交:

3. 创建App的 APS证书
回到App IDs选择你需要推送的app.展开点击“Edit”:

找到最底部的Push Notifications,点击”Create Cerifcate…”创建push证书,这里开发环境的证书和发布环境的证书需要分别创建,也就是相同的流程要走两遍:

点击Continue继续:

上传创建好CSR文件(参照第一节) xxx.certSigningRequest (例子为:TXIMDemoAPS.certSigningRequest),点击“Generate”:

aps证书创建成功了,点击Download下载到本地。(文件名:开发版本为 aps_development.cer,发布版本为 aps.cer):

点击Done,你会发现该环境的push配置状态已经Enabled:

注意:有的App ID的Apple Push Notification service列是灰色的,并且不允许使用Configure按钮,这是因为APNS不支持带通配符的App ID。
4. 生成Push证书
导入证书
双击上一节下载的文件(aps_development.cer和aps.cer)将其安装到电脑,在“钥匙串访问”中,可以看到已经导入的证书。

右键选择导出为p12文件, (例:存储为TXIMDemoAPS.p12):

注意:开发版本证书只有在debug模式下开发的时候会生效,正式发布版本的证书,一定要使用正式版本的证书。
5. 生成Provisioning Profile文件(PP文件)
生成对应的描述文件,这里演示开发版描述文件的创建(发布版本的创建流程一样,用户可以自行操作),点击"Continue"

选择3.3步骤中创建推送证书那个App ID,点击"Continue",

选择3.3中创建的开发版推送证书(创建发布版描述文件时,选择3.3中创建的发布版推送证书),点击"Continue",

选择需要加入开发的设备,只有加入了的设备才能进行真机调试,创建发布版本时没有这个步骤,点击"Continue",

输入PP文件的名称,这里以IMDevPP为例

生成PP文件完成

注:以上所有的步骤,除了生成p12文件时必须要下载证书安装到本地,其它生成的文件都可以不下载到本地。
检查生成的PP文件
查看pp文件的状态一定要为Active

点击PP文件进入详细资料页面,状态也要是Active
6. Xcode中的配置
新版Xcode已经不需要手动配置证书和描述文件了,只需在General中选择正确的Team,Fix Issue即可,这也是上面所说的不用下载证书到本地安装的原因

网友评论