My application is sending push notifications using Quickblox push notification API with their iOS SDK. I am able to send and receive push notifications in the device successfully with payload information.
But, now the question is, in case of sending fails, how to recognize which push notification sending failed in QBActionStatusDelegate? Please assume here that multiple push notifications has been sent and are being processed in the background simultaneously.
Background information:
I am sending message like this (assume that correct payload has been set prior to this):
QBMPushMessage *message = [[QBMPushMessage alloc] initWithPayload:payload];
[QBMessages TSendPush:message toUsers:[NSString stringWithFormat:@"%d", USERID] delegate:self];
Then I receive the action status result like this:
#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?
}
}
Use case when the sending has failed is for instance when the device is out of network coverage and does have bad connection. See logs from this case.
<Warning>: AA MyMessagingService/QBActionStatusDelegate/completedWithResult:
QBMSendPushTaskResult failed; errors=("Connection closed due to timeout. Please
check your internet connection."), status=0
I am using Quickblox SDK library for iOS (latest git commit: Mon Dec 30 12:42:14 2013 +0200)
Try to use context - it helps to recognise queries
http://quickblox.com/developers/IOS#Performing_actions_with_context