3

我在 iOS 设备上使用 bluemix 上的新推送通知服务。

设备注册成功。当我检查 REST-API 时,我看到了设备 ID、令牌等。

但是,在设备上运行 iOS 应用程序会在首次运行和注册时使应用程序崩溃。

崩溃发生在CDVMFPPush.swiftfunc didRegisterForRemoteNotifications(deviceToken: NSData) 309 行 ( let pushToken = response.responseJson["token"] as! String)。

print(response)在这个函数中做了一个,似乎 responseJson 只包含 deviceId 和 userId。令牌丢失。当我再次使用 REST-Api 执行相同的请求时,响应似乎已完成。

我认为由于这个错误,推送注册没有完成,因为当我尝试在沙盒模式下运行服务时没有收到任何通知。

有任何想法吗?

(PS 我检查了这个解决方案 -尝试将设备注册到 Bluemix 上的 IBM Mobile First Push 服务时,iOS 应用程序崩溃- 设置了链接器标志 [-ObjC])

这是来自我的控制台的请求(编辑了 app-id/secret/device)

Response text: {"createdTime":"2016-06-07T15:28:55Z","lastUpdatedTime":"2016-06-07T15:28:55Z","createdMode":"API","deviceId":"xxxx","userId":"","token":"xxxx","platform":"A","href":"https://myapp.mybluemix.net:443/imfpush/v1/apps/xxxx/devices/xxxx"}
httpStatus: 201
responseHeaders: {
    Connection = "Keep-Alive";
    "Content-Type" = "application/json";
    Date = "Tue, 07 Jun 2016 15:28:55 GMT";
    Location = "https://myapp.mybluemix.net:443/imfpush/v1/apps/xxxx/devices/xxxx";
    "Transfer-Encoding" = Identity;
    "X-Backside-Transport" = "OK OK";
    "X-Global-Transaction-ID" = xxxx;
    "X-Powered-By" = "Servlet/3.0";
}
responseJson: {
    deviceId = "xxxxx";
    userId = "";
}
4

1 回答 1

1

我们已更新 MFPPush iOS 框架以解决该问题,并且已更新 MFPPush Cordova 插件以包含这些修复程序。我们怀疑崩溃是由于通过IMFResponse回调向您发送了第二个对象,而第二个 IMFResponse 的 responseJson 没有您看到的导致崩溃的令牌。这些更改应该可以解决该问题。

更新插件的最简单方法就是删除旧插件并重新添加它,您应该在版本1.0.14ibm-mfp-push查看修复。

也可以在今天早上看到相关 Github 上的更新 https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-cordova-plugin-push

于 2016-07-28T13:30:26.537 回答