1

I'm trying to setup push notifications for our app that uses quickblox. I've uploaded the correct iOS certificates and Google Keys,

I can:

Send from iOS to iOS

Send from Android to Android

Send from Android to iOS

But when i try to send from iOS to android i get an error for the SDK:

"No recipients. At least one user should be subscribed for APNS (Apple Push) (through SDK or REST API)"]

Which is weird because i'm trying to send message to GCM device, and the error says there's no APNS device.

How can i solve this issue? what can be interrupting pushed from iOS to Android?

This is how i'm sending the push

QBMPushMessage *pushMessage = [QBMPushMessage new];
pushMessage.alertBody = pushText;

NSMutableDictionary *additionalParams = [NSMutableDictionary new];
[additionalParams setObject:@1 forKey:@"isFromChat"];
if(dialogId){
    [additionalParams setObject:dialogId forKey:@"dialogId"];
}

[additionalParams setObject:messageText forKey:@"messageText"];


pushMessage.additionalInfo = additionalParams;

[QBRequest sendPush:pushMessage toUsers:recipientID successBlock:^(QBResponse *response, QBMEvent *event) {

    NSLog(@"Push was sent successfully to: %@", recipientID);

} errorBlock:^(QBError *error) {
    NSLog(@"Push Error: %@", error);
}];
slava
  • 1,901
  • 6
  • 28
  • 32
  • I have no actual experience with QB but I would check the udid of my devices. maybe one or more of the users push id's was revoked, and that is why it cannot be sent/received. for more info: [check this answer](http://stackoverflow.com/a/21691051/5208798). – Shahar.bm Aug 11 '15 at 17:27

2 Answers2

0

Apparently, we accidentally used a specific method that only send push notifications from iOS to iOS.

After we use a generic QBEvent it was fixed

0

You can't use sendPush:toUsers:successBlock:errorBlock: method. Take your QBMPushMessage *message variable and use this snippet.

QBMEvent *event = [QBMEvent event];
event.notificationType = QBMNotificationTypePush;
event.usersIDs = users;
event.type = QBMEventTypeOneShot;

NSError *error = nil;
NSData *sendData = [NSJSONSerialization dataWithJSONObject:message.payloadDict options:NSJSONWritingPrettyPrinted error:&error];
NSString *jsonString = [[NSString alloc] initWithData:sendData encoding:NSUTF8StringEncoding];

if (error) {
    //error handling
}

event.message = jsonString;

[QBRequest createEvent:event successBlock:^(QBResponse * _Nonnull response, NSArray<QBMEvent *> * _Nullable events) {

} errorBlock:^(QBResponse * _Nonnull response) {

}];
milczi
  • 7,064
  • 2
  • 27
  • 22