如何在Mobile App Buider中配置推送通知?

时间:2016-05-12 13:28:28

标签: ios ibm-cloud ibm-mobile-services

我使用Mobile App Builder制作原型。其中一个我需要发送推送通知。因此,我使用App Builder创建了一个App,并使用推送通知服务(App GUID和App Route)配置推送设置。

之后,我定义了设置Apple证书以发送推送(https://new-console.ng.bluemix.net/docs/services/mobilepush/t_push_provider_ios.html

因此,当我尝试使用推送通知服务(Bluemix)发送推送通知时,我收到一个消息: 1 - 内部服务器错误。找不到设备。

当我在XCode中看到一个登录时发现:

registerDeviceToken:completionHandler:]_block_invoke_2 in IMFPushClient.m:116 :: Response of device registration - Response is: httpStatus: 201
responseHeaders: {
    Connection = "Keep-Alive";
    "Content-Type" = "application/json";
    Date = "Thu, 12 May 2016 18:21:22 GMT";
    Location = "https://enviarpush.mybluemix.net:443/imfpush/v1/apps/428e6b13-2cc7-4f99-8d7e-9741d6742709/devices/AFAF9994-535D-4F6C-9789-317E680833A8";
    "Transfer-Encoding" = Identity;
    "X-Backside-Transport" = "OK OK";
    "X-Global-Transaction-ID" = 2301423703;
    "X-Powered-By" = "Servlet/3.0";
}
responseJson: {
    createdMode = API;
    createdTime = "2016-05-12T18:21:22Z";
    deviceId = "AFAF9994-535D-4F6C-9789-317E680833A8";
    href = "https://enviarpush.mybluemix.net:443/imfpush/v1/apps/428e6b13-2cc7-4f99-8d7e-9741d6742709/devices/AFAF9994-535D-4F6C-9789-317E680833A8";
    lastUpdatedTime = "2016-05-12T18:21:22Z";
    platform = A;
    token = 7574a3f1d14a7a01f8d43663cef686b3cb66a634b71ed20608a739c4f55356db;
    userId = "";
}
Response text: {"createdTime":"2016-05-12T18:21:22Z","lastUpdatedTime":"2016-05-12T18:21:22Z","createdMode":"API","deviceId":"AFAF9994-535D-4F6C-9789-317E680833A8","userId":"","token":"7574a3f1d14a7a01f8d43663cef686b3cb66a634b71ed20608a739c4f55356db","platform":"A","href":"https://enviarpush.mybluemix.net:443/imfpush/v1/apps/428e6b13-2cc7-4f99-8d7e-9741d6742709/devices/AFAF9994-535D-4F6C-9789-317E680833A8"}

此信息确认我的设备已注册,我是对的吗?

由于

2 个答案:

答案 0 :(得分:3)

展望未来,我们将整合设备注册,在我们实验期间,我们将创建一些博客文章,解释您需要在代码中手动完成的一些关键集成。这将包括我们建议如何与bluemix后端集成。

答案 1 :(得分:1)

您必须将设备注册到IBM推送通知服务才能成功接收推送通知。我建议查看以下文档:

Enabling iOS applications to receive push notifications

还有一个展示这些功能的示例:

HelloPush