Vol561
Vol561
  • 发布:2017-06-20 18:30
  • 更新:2017-09-28 18:54
  • 阅读:2448

ios离线打包,获取不到DeviceToken

分类:5+ SDK

ios离线打包,集成个推
问题:个推集成正常,应用在线时,能收到推送,但应用离线后 收不到推送。
能获取到ClientId,但获取不到DeviceToken,使用plus.push.getClientInfo().token也获取不到Token。
AppDelegate.m中的didRegisterForRemoteNotificationsWithDeviceToken方法也没有被调用,didRegisterForRemoteNotificationsWithDeviceToken方法也没有被调用。

我的工程做了如下设置:
1、Capabilities->Push Notifications 推送功能已经打开
Capabilities->Background Modes 中也勾选了 Background fetch和 Remote notifications

2、General->Signing(Debug) 和 Signing(Release)中设置好了对应的 开发 和 发布的provisioning Profile文件
Code Signing Indentity 的Debug和Release分别设置了 开发证书和发布证书
Provisioning Profile中的Debug和Release也分别设置了 开发描述文件 和 发布描述文件

3、info.plist中 设置好了 getui相关的key

4、也已经添加了
liblibPush.a
libGeTuiPush.a
libGeTuiSdk.a(使用新版个推SDK替换的)
libGtExtensionSdk.a(使用新版个推SDK替换的)
相关的Framework 和 LinkerFlags也添加了

5、AppDelegate.m中

  • (BOOL)application:(UIApplication )application didFinishLaunchingWithOptions:(NSDictionary )launchOptions
    {
    // 设置当前SDK运行模式
    BOOL ret = [PDRCore initEngineWihtOptions:launchOptions
    withRunMode:PDRCoreRunModeNormal];

    //APNS注册通知
    if ([UIDevice currentDevice].systemVersion.doubleValue<8.0) {
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeBadge)];
    }
    else {
    [[UIApplication sharedApplication] registerForRemoteNotifications];
    [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge|UIUserNotificationTypeSound|UIUserNotificationTypeAlert categories:nil]];
    }
    return ret;
    }
    我尝试在 这个方法中 手动注册了APNS,但同样没有回调这个方法didRegisterForRemoteNotificationsWithDeviceToken

    我尝试另外创建了一个新的工程,使用同样的Bundle id,同样的证书文件,进行了APNS注册,是可以在didRegisterForRemoteNotificationsWithDeviceToken的回调中,获取到DeviceToken的。

求助~我已经尝试过很多方案了


忘记这个问题了,统一回复:
我后来改成使用 ios原生集成个推,没有使用HBuild里集成的个推

2017-06-20 18:30 负责人:无 分享
已邀请:
向大海

向大海

thankes,我也是离线收不到消息1、Capabilities->Push Notifications 推送功能已经打开设置一下就好了

我也打开了Capabilities->Push Notifications 推送功能,没什么卵用,还是获取不到deviceToken

请问这个问题解决了吗

  • Vol561 (作者)

    我放弃了,改成了使用ios原生集成个推

    2017-10-12 18:37

骁骑

骁骑

检查一下AppDelegate文件里是不是有一个个推的宏 如果有把那个删了

该问题目前已经被锁定, 无法添加新回复