integrateUniPushIOS
集成 DCloud UniPush(iOS 离线打包):同步 PandoraApi.bundle/feature.plist 的 Push 节点、链接依赖,并写入后台推送所需的 Info.plist / entitlements。
文档:https://nativesupport.dcloud.net.cn/AppDocs/usemodule/iOSModuleConfig/push
函数签名
typescript
function integrateUniPushIOS(
projectPath: string,
projectName: string,
bundleId: string,
config: UniPushIOSConfig,
deps: IntegrateIOSThirdPartyModuleDeps,
): Promise<{ success: boolean; message?: string; error?: string; logs: string[] }>Push 节点
SDK 自带的 Push 节点只有 baseclass=PGPush、server.class=PGPushServer,不会启用 UniPush。集成时会改成文档要求的结构:class=PGPushActualize,server.class=PGPushServerAct。
feature.plist 不在 {projectPath}/{projectName}/PandoraApi.bundle。官方路径是 {sdkRoot}/SDK/Bundles/PandoraApi.bundle。
查找顺序:
pandoraApiBundlePath(传入后只认这一处,找不到即失败){projectPath}/{projectName}/PandoraApi.bundle{sdkPath}/SDK/Bundles/PandoraApi.bundle(以及{sdkPath}/Bundles/PandoraApi.bundle){projectPath}/../SDK/Bundles/PandoraApi.bundle{projectPath}/SDK/Bundles/PandoraApi.bundle
都找不到时返回 success: false,不会再继续拷贝静态库。syncFeaturePlistPush: false 可跳过这一步,此时 UniPush 不会生效。
还会写入
| 项 | 默认 | 说明 |
|---|---|---|
Info.plist getui | 有字段才写 | appid / appkey / appsecret |
UIBackgroundModes = remote-notification | 开启 | enableRemoteNotificationBackgroundMode: false 可跳过 |
entitlements aps-environment | development | production 用于发布描述文件;false 跳过。buildIOSApp 在未传时按 Debug / Release 选择 |
| Xcode Push Notifications | 尽量写入 | project.pbxproj 的 com.apple.Push 与 CODE_SIGN_ENTITLEMENTS。写不进去时日志会要求在 Signing & Capabilities 里手动添加 |
APNs 证书和带 Push 的 Provisioning Profile 仍需在 Apple 后台配置,且 aps-environment 要和描述文件一致。