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

How to configure Push Notification in Mobile App Buider?

我正在使用 Mobile App Builder 制作一些原型。其中之一我需要发送推送通知。因此,我使用 App Builder 创建了一个 App,并使用 Push Notification Services(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"}

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

谢谢

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

Enabling iOS applications to receive push notifications

还有一个示例可以演示这些功能:

HelloPush

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