【发布时间】:2014-01-17 12:17:50
【问题描述】:
我的应用程序使用 Quickblox 推送通知 API 和他们的 iOS SDK 发送推送通知。我能够使用有效负载信息在设备中成功发送和接收推送通知。
但是,现在的问题是,在发送失败的情况下,如何在QBActionStatusDelegate中识别哪个推送通知发送失败?这里假设已经发送了多个推送通知发送并同时在后台处理。
背景资料:
我正在发送这样的消息(假设在此之前已设置正确的有效负载):
QBMPushMessage *message = [[QBMPushMessage alloc] initWithPayload:payload];
[QBMessages TSendPush:message toUsers:[NSString stringWithFormat:@"%d", USERID] delegate:self];
然后我收到这样的动作状态结果:
#pragma mark QBActionStatusDelegate
- (void)completedWithResult:(Result *)result
{
if ([result isKindOfClass:QBMSendPushTaskResult.class]) {
// Send Push Notifications result
if (result.success) {
// success
}
else {
// failed
// TODO: try to resend the push notification
// how?
}
}
发送失败的用例是例如设备不在网络覆盖范围内并且确实连接不良。查看此案例的日志。
<Warning>: AA MyMessagingService/QBActionStatusDelegate/completedWithResult:
QBMSendPushTaskResult failed; errors=("Connection closed due to timeout. Please
check your internet connection."), status=0
我正在使用适用于 iOS 的 Quickblox SDK 库(最新的 git 提交:Mon Dec 30 12:42:14 2013 +0200)
【问题讨论】: