You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Nativescript iOS端Pusher配置问题:已注册远程通知但控制台显示等待设备

针对Pusher iOS端控制台显示“Waiting For Device”的排查方案

我之前也碰到过类似的Pusher推送同步问题,给你几个实际排查的方向,应该能帮到你:

  • 确保设备Token正确传递给Pusher SDK
    系统的UIApplication.shared.registeredForRemoteNotifications返回true只说明iOS系统已经成功注册APNS,但Pusher并不会自动获取到这个Token。你必须在AppDelegate的didRegisterForRemoteNotificationsWithDeviceToken回调里,手动把Token传给Pusher:

    func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
        // 把设备Token传给Pusher
        PusherPushNotifications.shared().registerDeviceToken(deviceToken)
        // 确保订阅兴趣组的操作在Token注册之后执行
        PusherPushNotifications.shared().subscribe(interest: "hello")
    }
    

    如果漏了这一步,Pusher控制台永远不会收到设备的注册状态。

  • 核对APNS配置与Pusher控制台的一致性

    • 检查p8密钥:确保你上传的p8文件是对应当前Team ID的有效密钥,且拥有APNs推送权限。建议直接重新下载p8文件并上传到Pusher控制台,避免复制粘贴时的字符错误。
    • 确认Team ID和Bundle ID:Pusher控制台填写的Team ID、Bundle ID必须和Xcode项目中的完全一致,大小写、拼写都不能有偏差——哪怕一个字符不对,都会导致推送通道无法建立。
  • 检查环境与权限设置

    • 匹配APNS环境:如果当前是Debug模式运行App,Pusher控制台的APNS环境要选择Sandbox;Release模式则选Production,环境不匹配会导致Pusher无法识别设备。
    • 确认Xcode权限:在项目的Signing & Capabilities中,确保Push Notifications已开启,同时Background Modes里的Remote notifications也已勾选——这两个权限是推送正常工作的基础。
  • 开启日志定位问题
    打开Pusher SDK的调试日志,在初始化时添加:

    PusherPushNotifications.shared().debugLogsEnabled = true
    

    运行App后查看Xcode控制台的日志,重点关注是否有Token注册失败、订阅失败的提示,这些日志能直接帮你找到问题根源。另外也可以在Xcode的Console面板搜索APNs或Pusher,排查注册过程中的异常信息。

内容的提问来源于stack exchange,提问作者Omar Al-Ashi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.06 14:12:52