@tencentcloud/sdk-mcp 1.6.0-beta.3 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,341 @@
1
+ 在 iOS App 中接入 TIMPush 前,需要先完成 Apple Developer 侧的推送能力配置,并在腾讯云控制台上传 APNs 推送证书。完成本篇配置后,您将获得后续 SDK 接入所需信息。
2
+
3
+ ## 前提条件
4
+
5
+ 开始前,请确认您已具备以下条件:
6
+
7
+ |条件|说明|
8
+ |---------|---------|
9
+ |Apple Developer 账号|用于创建 App ID、APNs 证书、描述文件和 App Groups。|
10
+ |iOS App 的 Bundle ID|需要与 Xcode 工程主 App target 的 Bundle Identifier 完全一致。|
11
+ |腾讯云账号和即时通信 IM 应用权限|用于创建 Push 应用、上传 APNs 证书并获取后续 SDK 接入参数。|
12
+ |Xcode 工程|用于本文中的主 App target 配置。|
13
+
14
+ ## Xcode 配置
15
+
16
+ ### 确认 Bundle ID
17
+
18
+ Bundle ID 是 APNs 推送主题、Apple App ID、描述文件、Xcode 工程和腾讯云 APNs 证书配置之间的关键匹配项。请先在 Xcode 中确认主 App target 的 Bundle Identifier。
19
+ 1. 打开 Xcode 工程。
20
+
21
+ 2. 选择主 App target。
22
+
23
+ 3. 单击 **Signing & Capabilities**。
24
+
25
+ 4. 查看 **Bundle Identifier**。
26
+
27
+ 请记录该值,后续在 Apple Developer Center 和腾讯云控制台中均需使用。
28
+
29
+ > **注意:**
30
+ >
31
+
32
+ > Bundle ID 不能使用通配符 `*`,否则无法使用 APNs 远程推送。
33
+ >
34
+
35
+ ### 开启 Push Notifications
36
+
37
+ 确认 Bundle ID 后,建议继续在 Xcode 主 App target 中启用 Push Notifications,避免后续再回到 Xcode 重复操作。
38
+ 1. 打开 Xcode 工程。
39
+
40
+ 2. 选择主 App target。
41
+
42
+ 3. 单击 **Signing & Capabilities**。
43
+
44
+ 4. 单击 **+ Capability**。
45
+
46
+ 5. 添加 **Push Notifications**。
47
+
48
+ 6. 确认 target 中出现 **Push Notifications** 能力。
49
+
50
+ > **注意:**
51
+ >
52
+
53
+ > 无论使用 Xcode 自动签名还是手动签名,都需要在 Apple Developer Center 的 App ID 上启用 Push Notifications,详见下一组 Apple Developer Center 操作。自动签名会自动同步描述文件;手动签名还需要手动重新生成并下载描述文件。
54
+ >
55
+
56
+ ## Apple Developer Center 配置
57
+
58
+ > **说明:**
59
+ >
60
+
61
+ > 本文配置流程可对照 Apple 官方 [User Notifications - Setting up a remote notification server](https://developer.apple.com/documentation/usernotifications) 操作;如遇页面变更,请以 Apple 官方最新文档为准。
62
+ >
63
+
64
+ ### 创建或确认 App ID
65
+
66
+ App ID 用于声明你的 iOS App 能力。若你已经有与主 App Bundle ID 对应的 App ID(也就是你从上一个步骤中获取的 Bundle Identifier),可直接确认其能力配置;如果没有,请参考下列步骤新建 App ID。
67
+ 1. 登录 [Apple Developer](https://developer.apple.com/account/)。
68
+
69
+ 2. 进入 **Certificates, Identifiers & Profiles**。
70
+
71
+ 3. 在左侧导航栏选择 **Identifiers**。
72
+
73
+ 4. 单击 **+**。
74
+
75
+ 5. 选择 **App IDs**,单击 **Continue**。
76
+
77
+ 6. 选择 **App**,单击 **Continue**。
78
+
79
+ 7. 填写 App ID 描述和 Bundle ID。
80
+
81
+ 8. 单击 **Continue** 并确认创建。
82
+
83
+ ### 开启 Push Notifications 能力
84
+
85
+ 创建或确认 App ID 后,需要为该 App ID 开启 Push Notifications。
86
+ 1. 在 **Identifiers** 列表中选择目标 App ID。
87
+
88
+ 2. 切换到 **Capabilities** 标签。
89
+
90
+ 3. 勾选 **Push Notifications**。
91
+
92
+ 4. 单击 **Save**,并在弹窗中确认修改 App ID。
93
+
94
+ 5. 完成后,**Push Notifications** 行右侧会出现 **Configure** 按钮。如果后续使用 p12 证书,需要从该按钮进入证书创建流程;如果使用 p8 证书,可以忽略该按钮。
95
+
96
+ 完成后,请确认目标 App ID 的能力列表中已包含 **Push Notifications**。
97
+
98
+ ### 选择 APNs 证书类型
99
+
100
+ Apple APNs 推送证书主要有 p8 和 p12 两种方式。新接入 TIMPush 时,推荐优先使用 p8 证书。
101
+
102
+ |类型|推荐程度|适用场景|注意事项|
103
+ |---------|---------|---------|---------|
104
+ |p8 证书|推荐|新接入用户优先选择。|p8 文件只可下载一次,需要妥善保存。Auth Key 文件本身无有效期。多 Bundle ID 处理方式参见上文 确认 Bundle ID。|
105
+ |p12 证书|传统方式|已有 p12 证书体系,或必须使用证书方式鉴权的项目。|证书有有效期,需要设置导出密码;自 2020 年起 Apple 已合并为同时覆盖 Sandbox 和 Production 的一张证书,无需分别为开发和生产创建。|
106
+
107
+ #### 创建 p8 证书(推荐)
108
+
109
+ p8 证书是 APNs Auth Key,用于腾讯云服务端向 APNs 鉴权。创建 p8 证书前,请确保已完成 App ID 和 Push Notifications 配置。
110
+ 1. 登录 [Apple Developer](https://developer.apple.com/account/)。
111
+
112
+ 2. 进入 **Certificates, Identifiers & Profiles**。
113
+
114
+ 3. 在左侧导航栏选择 **Keys**。
115
+
116
+ 4. 单击 **+**创建新的 Key。
117
+
118
+ 5. 输入 Key 名称。
119
+
120
+ 6. 勾选 **Apple Push Notifications service (APNs)**。
121
+
122
+ 7. (可选)单击 **Configure** 可进一步限定 Key 范围:
123
+
124
+ - **Environment**:默认 Sandbox & Production(开发和生产共用),也可限定仅 Sandbox 或仅 Production。
125
+
126
+ - **Topic**:默认 Team-scoped(同一 Team 下所有 App 可用),也可选 Topic-specific 并指定 Bundle ID。
127
+
128
+ 新接入 TIMPush 若没有特殊安全诉求,保持默认即可。该能力为 Apple 2025 年 2 月推出的可选增强项,已有 Key 不受影响。
129
+
130
+ 8. 单击 **Continue**。
131
+
132
+ 9. 确认信息后,单击 **Register**。
133
+
134
+ 10. 单击 **Download** 下载 `.p8` 文件。
135
+
136
+ > **警告:**
137
+ >
138
+
139
+ > p8 文件只可下载一次,请妥善保存。若文件丢失,需要重新创建新的 Key。
140
+ >
141
+
142
+ 请同时记录以下信息,后续上传到腾讯云控制台时需要填写:
143
+
144
+ | 信息 | 获取位置 |
145
+ | --- | --- |
146
+ | Key ID | Apple Developer Center 的 Keys 列表对应行或 Key 详情页,10 位字符。 |
147
+ | Team ID | Apple Developer 网站右上角账号信息,或 <strong>Account > Membership details</strong> 页面,10 位字符。 |
148
+ | Bundle ID | 主 App 的 Bundle ID。 |
149
+ | p8 文件 | 创建 Key 后下载的 <code>.p8</code> 文件。 |
150
+
151
+ #### 创建 p12 证书,传统方式
152
+
153
+ 如果您选择 p12 证书,请按以下步骤创建 APNs 推送证书。详细规则可参见 Apple 官方文档 [Establishing a certificate-based connection to APNs](https://developer.apple.com/documentation/usernotifications/establishing-a-certificate-based-connection-to-apns)。
154
+ 1. 登录 [Apple Developer](https://developer.apple.com/account/)。
155
+
156
+ 2. 进入 **Certificates, Identifiers & Profiles**。
157
+
158
+ 3. 在左侧导航栏选择 **Identifiers**。
159
+
160
+ 4. 选择目标 App ID。
161
+
162
+ 5. 在 **Push Notifications** 区域单击 **Configure**。
163
+
164
+ 6. 在 **Production SSL Certificate** 区域单击 **Create Certificate**。自 2020 年起,Apple 的 SSL 证书已合并为同时覆盖 Sandbox 和 Production 的一张证书(即 **Apple Push Notification service SSL (Sandbox & Production)**),无需分别为开发和生产创建两张证书。
165
+
166
+ 7. 按页面提示在 Mac 的 **钥匙串访问** 中生成 Certificate Signing Request(CSR)文件。
167
+
168
+ 8. 上传 CSR 文件并生成 APNs 证书。
169
+
170
+ 9. 下载证书并双击导入钥匙串。导入后,证书会出现在 **登录** 钥匙串的 **我的证书** 分类下。
171
+
172
+ 10. 在 **钥匙串访问** > **登录** > **我的证书** 中找到名为 `Apple Push Services: <您的 Bundle ID>` 的证书,单击左侧 **展开三角**,确认证书下方挂着对应的 **私钥**。
173
+
174
+ 11. 同时选中 **证书** 和 **私钥**,右键选择 **导出 2 项**,文件格式选择 **个人信息交换 (.p12)**,并在弹窗中输入密码保护 p12 文件。
175
+
176
+ > **注意:**
177
+ >
178
+ > 1. 必须连同私钥一起导出,否则生成的 p12 文件不能用于 APNs 鉴权。如果证书下方没有私钥,说明 CSR 不是在当前 Mac 生成的,请回到生成 CSR 的 Mac 重新导出。
179
+ > 2. 上传 p12 证书到腾讯云控制台时需要填写证书密码。无密码或密码错误可能导致推送失败。
180
+
181
+ ### 创建或确认描述文件
182
+
183
+ 描述文件(Provisioning Profile)用于将 App ID、证书和设备等签名信息绑定到 Xcode 工程。
184
+
185
+ > **说明:**
186
+ >
187
+
188
+ > 如果您在 Xcode 中使用 **Automatically manage signing**(自动签名),Xcode 会在 App ID 启用 Push Notifications 后自动同步描述文件,本节可跳过。仅在使用手动签名,或 Xcode 自动签名失败需要手动处理时,才需按以下步骤创建描述文件。
189
+ >
190
+
191
+ 如需手动管理,请在 Apple Developer Center 中创建:
192
+ 1. 登录 [Apple Developer](https://developer.apple.com/account/)。
193
+
194
+ 2. 进入 **Certificates, Identifiers & Profiles**。
195
+
196
+ 3. 在左侧导航栏选择 **Profiles**。
197
+
198
+ 4. 单击 **+**创建新的 Profile。
199
+
200
+ 5. 根据用途选择 **iOS App Development** 或 **App Store**。
201
+
202
+ 6. 选择主 App 对应的 App ID。
203
+
204
+ 7. 选择签名证书和设备(开发描述文件需要选择设备)。
205
+
206
+ 8. 输入 Profile 名称并生成。
207
+
208
+ 9. 下载并安装描述文件。
209
+
210
+ ## 腾讯云控制台配置
211
+
212
+ ### 在腾讯云控制台创建 Push 应用并开通服务
213
+
214
+ 完成 Apple 侧证书准备后,需要在腾讯云控制台创建 Push 应用,并确认 Push 服务已开通。
215
+ 1. 登录 [腾讯云控制台](https://console.cloud.tencent.com/)。
216
+
217
+ 2. 进入 **即时通信 IM** > **推送服务 Push** > **概览**。
218
+
219
+ 3. 创建或选择目标 Push 应用。
220
+
221
+ 4. 记录控制台展示的 `SDKAppID` 和客户端密钥。
222
+
223
+ 5. 在控制台确认 Push 服务状态,并按页面提示完成开通。注意,创建 Push 应用不等于 Push 服务已开通。
224
+
225
+ 创建 Push 应用后,腾讯云控制台会自动创建相同 `SDKAppID` 的 Chat 应用。
226
+
227
+ > **警告:**
228
+ >
229
+
230
+ > Push 的 Key 和 Chat 的 Key 不同,不能混用。后续调用 `registerPush` 使用 Push 的客户端密钥;Chat 登录使用 Chat 的密钥。
231
+ >
232
+
233
+ | <strong>registerPush 使用的客户端密钥</strong> | <strong>Chat 登录使用的密钥</strong> |
234
+ | --- | --- |
235
+ | | |
236
+
237
+ ### 上传 APNs 证书到腾讯云控制台
238
+
239
+ 在腾讯云控制台上传 APNs 证书后,控制台会生成证书 ID。该证书 ID 是后续 SDK 接入文档中的 `businessID`。
240
+
241
+ 操作路径:`腾讯云控制台 > 即时通信 IM > 推送服务 Push > 推送设置 > 厂商配置 > iOS > 添加 APNs 证书`。
242
+
243
+ #### 上传 p8 证书
244
+ 1. 进入 iOS APNs 证书配置页面。
245
+
246
+ 2. 选择 p8 证书类型。
247
+
248
+ 3. 上传 `.p8` 文件。
249
+
250
+ 4. 填写 Key ID、Team ID 和 Bundle ID。
251
+
252
+ 5. 根据控制台要求选择开发环境或生产环境。
253
+
254
+ 6. 保存配置。
255
+
256
+ 7. 记录控制台生成的证书 ID。
257
+
258
+ #### 上传 p12 证书
259
+ 1. 进入 iOS APNs 证书配置页面。
260
+
261
+ 2. 选择 p12 证书类型。
262
+
263
+ 3. 上传 `.p12` 文件。
264
+
265
+ 4. 填写导出 p12 时设置的证书密码。
266
+
267
+ 5. 根据控制台要求选择开发环境或生产环境。
268
+
269
+ 6. 保存配置。
270
+
271
+ 7. 记录控制台生成的证书 ID。
272
+
273
+ > **注意:**
274
+ >
275
+
276
+ > 上传证书时,请确认 Bundle ID 与主 App 的 Bundle Identifier 一致。发布到 App Store 的 App 需要使用生产环境证书配置。
277
+ >
278
+
279
+ ## 触达统计资源配置(可选)
280
+
281
+ 如果您仅需要接收普通离线推送,不统计推送触达率,跳过本节。
282
+
283
+ 如果您需要统计推送触达率,请按下文在 Apple Developer Center 和 Xcode 中准备 App Groups;如果后续创建 Notification Service Extension,也需要为 Extension 准备对应的 App ID 和描述文件。
284
+
285
+ 触达统计基于 iOS [App Groups](https://developer.apple.com/documentation/xcode/configuring-app-groups) 在主 App 与 [UNNotificationServiceExtension](https://developer.apple.com/documentation/usernotifications/unnotificationserviceextension) 之间共享数据。Extension 在通知送达前被系统调用,向 TIMPush 上报触达事件。
286
+
287
+ ### 在 Apple Developer Center 创建 App Group ID
288
+ 1. 登录 [Apple Developer](https://developer.apple.com/account/)。
289
+
290
+ 2. 进入 **Certificates, Identifiers & Profiles**。
291
+
292
+ 3. 在左侧导航栏选择 **Identifiers**。
293
+
294
+ 4. 选择 **App Groups**。
295
+
296
+ 5. 单击 **+**创建新的 App Group。
297
+
298
+ 6. 输入 App Group ID,例如 `group.<您的 Bundle ID>`,建议与主 App Bundle ID 关联,便于识别。
299
+
300
+ 7. 保存配置。
301
+
302
+ ### 在 Apple Developer Center 绑定 App Groups
303
+ 1. 将主 App 的 App ID 绑定到该 App Group。
304
+
305
+ 2. 如果需要触达统计,请创建或确认 Extension App ID。Extension 的 Bundle ID **必须以主 App Bundle ID 为前缀**(Apple 强制要求),例如主 App Bundle ID 为 `com.example.myapp` 时,Extension Bundle ID 应为 `com.example.myapp.NotificationServiceExtension`。
306
+
307
+ 3. 将 Extension App ID 绑定到同一个 App Group。
308
+
309
+ 4. 为 Extension App ID 创建或确认描述文件。
310
+
311
+ ### 在 Xcode 配置 App Groups
312
+ 1. 打开 Xcode 工程。
313
+
314
+ 2. 选择主 App target。
315
+
316
+ 3. 单击 **Signing & Capabilities**。
317
+
318
+ 4. 单击 **+ Capability**,添加 **App Groups**。
319
+
320
+ 5. 勾选在 Apple Developer Center 创建的 App Group ID。
321
+
322
+ 6. 如果工程中已创建 Extension target,请在 Extension target 中勾选同一个 App Group ID。
323
+
324
+ ## 配置完成检查
325
+
326
+ 完成本篇配置后,请按顺序检查:
327
+
328
+ |检查项|预期结果|
329
+ |---------|---------|
330
+ |Bundle ID 一致性|主 App 的 Bundle ID 已确认,且不是通配符;与 Apple App ID、APNs 证书、腾讯云控制台 APNs 配置绑定的 Bundle ID 完全一致。|
331
+ |Xcode Push 能力|主 App target 已在 **Signing & Capabilities** 中开启 **Push Notifications**。|
332
+ |Apple App ID|已创建或确认主 App 的 App ID,并为该 App ID 开启 Push Notifications 能力。|
333
+ |APNs 证书|已创建 p8 或 p12 证书;若使用 p8,已保存 `.p8` 文件、Key ID、Team ID 和 Bundle ID;若使用 p12,已保存 `.p12` 文件、证书密码(导出时设置)和 Bundle ID。|
334
+ |描述文件|主 App 描述文件已创建或确认(自动签名由 Xcode 自动同步,手动签名需手动重新生成并下载)。|
335
+ |腾讯云 Push 应用|已在腾讯云控制台创建 Push 应用,并记录 `SDKAppID` 和客户端密钥|
336
+ |Push 密钥与 Chat 密钥区分|已了解 Push Key 与 Chat Key 不同,后续 `registerPush` 使用 Push 客户端密钥,Chat 登录使用 Chat 密钥,不会混用。|
337
+ |腾讯云 APNs 证书|已在腾讯云控制台上传 APNs 证书,并记录控制台生成的证书 ID(即 `businessID`)。|
338
+ |Push 服务开通状态|已在腾讯云控制台确认 Push 服务已开通(创建 Push 应用不等于服务已开通)。|
339
+ |App Group(可选)|如需触达统计,已创建 App Group ID,并为主 App 和 Notification Service Extension 配置同一个 App Group;同时已准备 Extension 对应的 App ID 和描述文件。|
340
+
341
+ 下一步请前往 iOS SDK 接入,集成 TIMPush。
@@ -0,0 +1,205 @@
1
+ React Native 推送目前支持小米、华为、荣耀、OPPO、vivo、魅族、APNs、一加、realme、iQOO 、FCM 和 苹果等厂商通道。
2
+
3
+ > **注意:**
4
+ >
5
+
6
+ > 每个厂商仅支持配置 1 个证书。
7
+ >
8
+
9
+ 【iOS】
10
+
11
+ 集成** @tencentcloud/react-native-push** 之前,需要先向 Apple 申请 APNs 推送证书,然后上传推送证书到 IM 控制台 。之后按照快速接入步骤接入即可。
12
+
13
+ Apple 厂商配置目前有两种主流的证书,p12 证书和 p8 证书。两种证书各有优劣,您可按需要选择其中的一种。
14
+ | | <strong>证书类型</strong> | <strong>有效期和管理</strong> | <strong>安全性</strong> | <strong>灵动岛</strong> |
15
+ | --- | --- | --- | --- | --- |
16
+ | <strong>p12 证书</strong> | p12 证书是一个包含公钥和私钥的二进制文件,用于基于证书的身份验证。它将公钥证书和私钥捆绑在一个文件中,扩展名为 .p12 或 .pfx。 | p12 证书通常有一年的有效期,过期后需要重新生成和部署。每个应用程序都需要单独的 P12 证书来处理推送通知。 | p12 证书使用基于证书的身份验证,需要在服务器上存储私钥。这可能会增加安全风险,因为私钥可能会被未经授权的用户访问。 | 不支持 |
17
+ | <strong>p8 证书</strong> | p8 证书是一个 Auth Key(授权密钥),用于基于令牌的身份验证。它是一个包含私钥的文本文件,扩展名为 .p8。 | p8 证书没有到期日期,因此您无需担心证书过期。此外,使用 P8 证书可以简化证书管理,因为您可以使用一个 p8 证书为多个应用程序提供推送通知服务。 | p8 证书使用基于令牌的身份验证,这意味着您的服务器会周期性地生成一个 JSON Web Token(JWT)来与 APNs 建立连接。这种方法更安全,因为它不需要在服务器上存储私钥。 | 支持灵动岛推送 |
18
+
19
+ ## 操作步骤
20
+
21
+ 【p8 证书(推荐)】
22
+
23
+ p8 证书:p8 证书没有到期日期,因此您无需担心证书过期。此外,使用 p8 证书可以简化证书管理,因为您可以使用一个 p8 证书为多个应用程序提供推送通知服务。另外,p8 证书支持灵动岛推送。
24
+
25
+ ### 步骤1:申请 APNs 证书
26
+
27
+ 要创建 p8 证书文件,首先需要登录 [苹果开发者中心](https://developer.apple.com/)。
28
+
29
+ 1. 进入 Certificates, Identifiers & Profiles:在页面右上角单击 **Account**,然后在下拉菜单中选择 **Certificates, Identifiers & Profiles** 。
30
+
31
+ 2. 创建一个新的 App ID:在左侧菜单中单击 **Identifiers** ,然后单击右侧的 **+** 创建一个新的 App ID。填写相应的信息并单击 **Continue **。
32
+
33
+ 3. 创建一个新的密钥:在左侧菜单中单击 **Keys**,然后单击右侧的 **+** 创建一个新的密钥。输入密钥的名称,然后勾选 **Apple Push Notifications service (APNs)**,单击 **Continue** 。
34
+
35
+ 确认并生成密钥:在确认页面核对您的密钥信息,然后单击 **Register** 。接下来,您将看到一个页面提示您下载密钥。单击 **Download**,将生成的 .p8 文件保存到您的计算机上。
36
+
37
+ > **说明:**
38
+ >
39
+ > - p8 证书只可以下载一次,请妥善保存。
40
+ > - 请妥善保管下载的 p8 文件,因为您将无法再次下载该文件。您可以使用此 P8证书配置您的 iOS 应用程序以接收推送通知。
41
+
42
+ ### 步骤2:上传 p8 证书到 IM 控制台
43
+ 1. 登录 [即时通信 IM 控制台](https://console.cloud.tencent.com/im)。
44
+
45
+ 2. 单击目标应用卡片,进入应用的基础配置页面。
46
+
47
+ 3. 单击 **iOS 原生离线推送设置**右侧的**添加证书**。
48
+
49
+ 4. 选择 **p8 证书**。
50
+
51
+ > **说明:**
52
+ >
53
+ > - **Key ID**:这是您的 APNs Auth Key 的唯一标识符。当您在 Apple Developer Center 创建一个新的 APNs Auth Key 时,系统会为您生成一个 Key ID。您可以在 "Certificates, Identifiers & Profiles" 部分的 "Keys" 中找到它。
54
+ > - **Team ID**:这是您的开发者账户的唯一标识符。您可以在 Apple Developer Center 的账户详情页面找到它。点击右上角的 "Membership",在 "Membership Details" 部分可以找到您的 Team ID。
55
+ > - **Bundle ID**:这是您的应用程序的唯一标识符,也称为应用程序 ID。您可以在 Apple Developer Center 的 "Certificates, Identifiers & Profiles" 部分找到它。选择 "Identifiers",然后在您的应用程序列表中找到对应的 Bundle ID。
56
+
57
+ 【p12 证书】
58
+
59
+ ### 步骤1:申请 APNs 证书
60
+
61
+ #### 开启 App 远程推送
62
+ 1. 登录 [苹果开发者中心](https://developer.apple.com/account/) 网站,单击 **Certificates, Identifiers & Profiles** 或者侧栏的 **Certificates,IDs & Profiles**,进入 **Certificates, IDs & Profiles** 页面。
63
+
64
+ 2. 单击 Identifiers 右侧的 **+**。
65
+
66
+ 3. 您可以参见如下步骤新建一个 AppID,或者在您原有的 AppID 上增加 `Push Notification` 的 `Service`。
67
+
68
+ > **说明:**
69
+ >
70
+
71
+ > 您 App 的 `Bundle ID` 不能使用通配符 `*`,否则将无法使用远程推送服务。
72
+ >
73
+
74
+ 4. 勾选 **App IDs**,单击 **Continue** 进行下一步。
75
+
76
+ 5. 选择 **App**,单击 **Continue** 进行下一步。
77
+
78
+ 6. 配置 `Bundle ID` 等其他信息,单击 **Continue** 进行下一步。
79
+
80
+ 7. 勾选 **Push Notifications**,开启远程推送服务。
81
+
82
+ #### 生成证书
83
+ 1. 选中您的 AppID,选择 **Configure**。
84
+
85
+ 2. 可以看到在 **Apple Push Notification service SSL Certificates** 窗口中有两个 `SSL Certificate`,分别用于开发环境(Development)和生产环境(Production)的远程推送证书,如下图所示:
86
+
87
+ 3.
88
+
89
+ 我们先选择开发环境(Development)的 **Create Certificate**,系统将提示我们需要一个 Certificate Signing Request(CSR)。
90
+
91
+ 4. 在 Mac 上打开**钥匙串访问工具(Keychain Access)**,在菜单中选择**钥匙串访问 **> **证书助理 **> **从证书颁发机构请求证书**(`Keychain Access - Certificate Assistant - Request a Certificate From a Certificate Authority`)。
92
+
93
+ 5. 输入用户电子邮件地址(您的邮箱)、常用名称(您的名称或公司名),选择**存储到磁盘**,单击**继续**,系统将生成一个 `*.certSigningRequest` 文件。
94
+
95
+ 6. 返回上述 步骤3 中 Apple Developer 网站刚才的页面,单击 **Choose File** 上传生成的 `*.certSigningRequest` 文件。
96
+
97
+ 7. 单击 **Continue**,即可生成推送证书。
98
+
99
+ 8. 单击 **Download** 下载开发环境的 `Development SSL Certificate` 到本地。
100
+
101
+ 9. 再次按照上述步骤1 - 8,将生产环境的 `Production SSL Certificate` 下载到本地。
102
+
103
+ > **说明:**
104
+ >
105
+
106
+ > 生产环境的证书实际是开发(Sandbox)+生产(Production)的合并证书,可以同时作为开发环境和生产环境的证书使用。
107
+ >
108
+
109
+ 10. 双击打开下载的开发环境和生产环境的 `SSL Certificate`,系统会将其导入钥匙串中。
110
+
111
+ 11. 打开钥匙串应用,在**登录 **> **我的证书**,右键分别导出刚创建的开发环境(`Apple Development IOS Push Service`)和生产环境(`Apple Push Services`)的 `p12` 文件。
112
+
113
+ > **注意**
114
+ >
115
+
116
+ > 保存`.p12`文件时,请务必为其设置密码。
117
+ >
118
+
119
+ ### 步骤2:上传证书到控制台
120
+ 1. 登录 [即时通信 IM 控制台](https://console.cloud.tencent.com/im)。
121
+
122
+ 2. 单击目标应用卡片,进入应用的基础配置页面。
123
+
124
+ 3. 单击 **iOS 原生离线推送设置**右侧的**添加证书**。
125
+
126
+ 4. 选择证书类型,上传 iOS 证书(.p12),设置证书密码,单击**确认**。
127
+
128
+ > **说明:**
129
+ >
130
+ > - 上传证书名最好使用全英文(尤其不能使用括号等特殊字符)。
131
+ > - 上传证书需要设置密码,无密码收不到推送。
132
+ > - 发布 App Store 的证书需要设置为生产环境,否则无法收到推送。
133
+ > - 上传的 p12 证书必须是自己申请的真实有效的证书。
134
+
135
+ 5. 待推送证书信息生成后,记录证书的 ID。
136
+
137
+ 【Android】
138
+
139
+ ## 操作步骤
140
+
141
+ ### 步骤1:注册应用到厂商推送平台
142
+
143
+ 离线推送需要将您自己的应用注册到各个厂商的推送平台,得到 AppID 和 AppKey 等参数,来实现离线推送功能。目前国内支持的手机厂商有:[小米](https://dev.mi.com/xiaomihyperos/documentation/detail)、[华为](https://developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides/service-introduction-0000001050040060)、[荣耀](https://developer.hihonor.com/cn/kitdoc)、[OPPO](https://open.oppomobile.com/wiki/doc#id=10195)、[vivo](https://dev.vivo.com.cn/documentCenter/doc/281)、[魅族](https://open.flyme.cn/service/3),境外支持 [Google FCM](https://console.firebase.google.com/u/0/),是否需要上架商店详情如下:
144
+
145
+ |厂商|小米|华为|OPPO|vivo|魅族|荣耀|Google FCM|
146
+ |---------|---------|---------|---------|---------|---------|---------|---------|
147
+ |是否需要上架|是|否|是|是|否|否|否|
148
+
149
+ ### 步骤2:IM 控制台配置
150
+
151
+ 登录腾讯云 [即时通信 IM 控制台](https://console.qcloud.com/avc) ,在**推送服务 Push > 推送设置 > 厂商配置**功能栏添加各个厂商推送证书,并将您在步骤一中获取的各厂商的 AppId、AppKey、AppSecret 等参数配置给添加的推送证书。
152
+
153
+ > **说明:**
154
+ >
155
+
156
+ > 关于**点击后续动作**选项,如需使用本插件提供的点击跳转能力,请保持默认值不变,即通常是 “打开应用内指定页面” 并带有默认配置。
157
+ >
158
+
159
+ > 如需使用上报统计功能,也请保持此项默认值不变。
160
+ >
161
+
162
+ 【小米】
163
+
164
+ |厂商推送平台|IM 控制台配置|
165
+ |---------|---------|
166
+ |||
167
+
168
+ 【华为】
169
+ | 厂商推送平台 | IM 控制台配置 |
170
+ | --- | --- |
171
+ | | <strong>说明:</strong><br>Client ID 对应 AppID,Client Secret 对应 AppSecret。 |
172
+
173
+ 【OPPO】
174
+
175
+ |厂商推送平台|IM 控制台配置|
176
+ |---------|---------|
177
+ |||
178
+
179
+ 【vivo】
180
+
181
+ |厂商推送平台|IM 控制台配置|
182
+ |---------|---------|
183
+ |||
184
+
185
+ 回执配置请参考:[消息触达统计配置-vivo](https://cloud.tencent.com/document/product/269/100626#daa658b0-1ac0-44a8-8a47-7ec8822ebe82)
186
+
187
+ 【魅族】
188
+
189
+ |厂商推送平台|IM 控制台配置|
190
+ |---------|---------|
191
+ |||
192
+
193
+ 回执配置请参考:[消息触达统计配置-魅族](https://cloud.tencent.com/document/product/269/100626#daa658b0-1ac0-44a8-8a47-7ec8822ebe82)
194
+
195
+ 【荣耀】
196
+
197
+ |厂商推送平台|IM 控制台配置|
198
+ |---------|---------|
199
+ |||
200
+
201
+ 【Google FCM】
202
+
203
+ |厂商推送平台|IM 控制台配置|
204
+ |---------|---------|
205
+ |||