2016-04-01 7 views
1

Ich benutze Quickblox für meine Anwendung. Diese Anwendung ist für Android iOS beide. Ich arbeite an Push-Benachrichtigungen. Dafür verwende ich diesen Code:Quickblox universelle Push-Benachrichtigung funktioniert nicht.

// Send push to users with ids 292,300,1295 
    QBMEvent *event = [QBMEvent event]; 
    event.notificationType = QBMNotificationTypePush; 
    event.usersIDs = [NSString stringWithFormat:@"%ld", (long)recepID]; 
    event.type = QBMEventTypeOneShot; 

    // standart parameters 
    // read more about parameters formation http://quickblox.com/developers/Messages#Use_custom_parameters 
    // 
    NSMutableDictionary *dictPush = [NSMutableDictionary dictionary]; 
    [dictPush setObject:@"Message received from Bob" forKey:@"message"]; 
    [dictPush setObject:@"5" forKey:@"ios_badge"]; 
    [dictPush setObject:@"mysound.wav" forKey:@"ios_sound"]; 

    // custom params 
    [dictPush setObject:@"234" forKey:@"user_id"]; 
    [dictPush setObject:@"144" forKey:@"thread_id"]; 

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

    [QBRequest createEvent:event successBlock:^(QBResponse * _Nonnull response, NSArray<QBMEvent *> * _Nullable events) 
    { 
     // Successful response with event 
     NSLog(@"Create event successfully to: %ld", (long)recepID); 
    } 
       errorBlock:^(QBResponse * _Nonnull response) 
    { 
     // Handle error 
     NSLog(@"Create event error to: %@", response.error.description); 
    }]; 

Diesen erstellen Ereignis schlägt fehl, und es zeigt diesen Fehler:

Create event error to: 
    Error reasons:{ 
    errors =  (
     "No one can receive the message" 
    ); 
} 

Alle Geräte gibt es in subsciptions Abschnitt. Immerhin gibt es Fehler. Ich habe diesen Code von this quickblox document kopiert. Bitte hilf mir.

Antwort

0

es wurde gelöst, indem diese Zeile in meinem Code hinzufügen:

event.isDevelopmentEnvironment = ![QBApplication sharedApplication].productionEnvironmentForPushesEnabled; 
+0

FYI: Sie haben gezeigt, dass Fehlerursache erhalten es keine Abonnements von Benutzer war, wollte man Push-to senden :) –