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

标签 ios push-notification ibm-cloud ibm-mobile-services

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

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

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

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

我在这个函数中做了一个print(response),responseJson 似乎只包含deviceId 和userId。 token 丢失。 当我再次使用 REST-Api 做同样的请求时,响应似乎是完整的。

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

有什么想法吗?

(附:我检查了这个解决方案 - iOS Application crashes when trying to register the device to IBM Mobile First Push service on Bluemix - 链接器标志设置为 [-ObjC])

这是来 self 的控制台的请求(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 没有您看到的导致崩溃的 token 。这些更改应该可以解决该问题。

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

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

关于ios - 首次注册该服务时,iOS 上的 IBM-Bluemix 推送服务使应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37683867/

相关文章:

ios - 在 ios 应用程序中使用 facebook 应用程序登录在 safari "Login with Facebook app"中显示选项并且它在 ios 10.1 中不起作用

android - SMPP 中串联 SMS 的最大长度是多少?

ios - 如果 View Controller 位于不同项目的库和 Storyboard中,则无法解决 'NSUnknownKeyException' 错误

ios - 推送通知 - Firebase

android - Push Kit 什么时候会包含 android :exported attributes required for Android 12?

iOS Swift Firebase 存储错误 "No default Storage bucket found"

android - 系统刚启动时未收到 FCM 通知

python - 如何将第 3 方 Python 库导入 Bluemix?

php - bluemix 500错误简单查询

ibm-cloud - 云函数REST API : Creating a new action from a zip file