iOS 上的 IBM-Bluemix 推送服务在首次注册该服务时应用程序崩溃

IBM-Bluemix Push Service on iOS crashes app when first registering with the service

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

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

但是,运行在设备上启用 iOS-应用程序会在第一次 运行 和注册时崩溃应用程序。

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

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

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

有什么想法吗?

(P.S。我检查了这个解决方案 - - 链接器标志已设置 [-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 = "";
}

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

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

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