1、登录开发者账号,https://developer.apple.com/account。
iShot_2023-04-12_10.27.17.png
2、注册新的Bundle ID。
1)选择Identifiers,点击+,新增一个标志符。
iShot_2023-04-12_10.32.30.png
2)选择App IDs,点击继续。
iShot_2023-04-12_10.33.01.png
3)选择类型为App,点击继续。
iShot_2023-04-12_10.33.21.png
4)在本页面的能力标签下,选择Push Notification。
iShot_2023-04-12_10.35.42.png
5)填写描述和Bundle ID,注意Wildcard类型的Bundle ID不支持推送,推送证书的Bundle ID要选择Explicit。此外,如果填写的Bundle ID有重名,提交时会弹出提示“An App ID with Identifier 'com.xx.push' is not available. Please enter a different string.”,请重新填写后再提交。
iShot_2023-04-12_10.38.10.png
6)提交成功后,会有一个确认页面,核对信息无误,点击注册。
iShot_2023-04-12_10.38.49.png
7)返回总览页面,可看到新建的ID。
iShot_2023-04-12_10.43.18.png
3、创建Certificates证书。
1)首先,申请CertificateSigningRequest.certSigningRequest文件,待会儿创建Certificates证书时会用到。
a.打开“钥匙串访问->证书助理->从证书颁发机构请求证书”。
iShot_2023-04-12_10.55.32.png
b.填写申请苹果账号的邮箱地址,选择存储到磁盘。
iShot_2023-04-12_11.18.42.png
c.选择存储位置,点击存储,CSR文件就申请好了。
iShot_2023-04-12_11.19.01.png
2)登录开发者账号,选择Certificates,点击“+”创建Certificates证书。
iShot_2023-04-12_10.28.47.png
3)创建开发根证书(可选),安装根证书及生成p12。
a.选择开发证书,点击继续。
iShot_2023-04-12_14.19.09.png
b.选择本地CSR文件,点击继续。
iShot_2023-04-12_11.09.18.png
c.开发根证书这就创建好了,点击下载到本地。
iShot_2023-04-12_14.31.10.png
d.双击安装,选择登录,添加到钥匙串。
iShot_2023-04-12_14.35.17.png
注意:需上传了本地CSR生成的Certificates,才可正确安装到电脑,并导出p12。如果钥匙串里Certificates有重复,为避免Xcode真机运行“Provisioning profile "test_development_push" doesn't include signing certificate "Apple Development: (xxx)”,需删除重复安装的Certificates,重新安装,同时检查Xcode上的Code Signing。
e.选择“登录->证书”,找到添加的开发根证书,右键导出p12文件。
iShot_2023-04-12_14.36.30.png
f.输入证书密码。
iShot_2023-04-12_15.11.49.png
4)创建推送cer证书,安装及生成p12。过程和开发根证书类似。
a.选择Apple Push Notification service SSL (Sandbox),点击继续。
iShot_2023-04-12_10.29.54.png
b.App ID选择“步骤2”里新注册的Bundle ID,点击继续。
iShot_2023-04-12_10.44.08.png
c.选择本地CSR文件,点击继续。
iShot_2023-04-12_11.09.18.png
d.推送证书这就创建好了,点击下载到本地。
iShot_2023-04-12_10.45.36.png
e.双击添加到钥匙串,选择“登录->证书”,找到添加的push证书,右键导出p12文件。
iShot_2023-04-12_10.55.02.png
4、创建描述文件Profiles,并下载安装。
1)选择Profiles,点击+,新增一个描述文件。
iShot_2023-04-12_10.46.42.png
2)选择iOS App Development,点击继续。
iShot_2023-04-12_10.47.00.png
3)选择App ID,使用“步骤2”里新注册的Bundle ID,点击继续。
iShot_2023-04-12_10.47.39.png
4)选择cer证书,选择全部。
iShot_2023-04-12_10.51.37.png
5)选择设备,这里选择全部就可以了。如果需要添加新设备,可以创建完Profiles后,再编辑。即在Devices里添加完uuid后,编辑Profiles,将新设备添加进来。
iShot_2023-04-12_10.51.57.png
6)为描述文件起个名字,点击继续,即可完成。
iShot_2023-04-12_10.52.23.png
7)双击描述文件安装。注意安装时,电脑断开真机连接。
5、这就是证书创建的全部流程,我们获得了5个安装文件。如和实际有出入,欢迎指正。
iShot_2023-04-12_15.12.48.png