Subscription Message Service

I use some codes to subscribe to a chanel to receive messages in my app. Today i got this error code 502 that i don’t see in the document and after a few minutes of subscribing, my app crashed with this error. If i comment the codes for Subscription then everything works fine. Below are the codes i use for Subscription and the error i got. Please help me !!!
http://support.backendless.com/public/attachments/87893128936d3ac9dd579ae7846664be.png</img>
And the codes for Subscription:

  • (void)subscribe {
    //If Current user is a Shipper
    if ([User shared].type == 1) {
    [backendless.messagingService subscribe:@“default” subscriptionResponse:^(id response) {
    NSArray *messages = response;
    for (id obj in messages) {
    if ([obj isKindOfClass:[Message class]]) {
    Message *message = (Message *)obj;
    NSLog(@“New message has arrived !”);
    [self getInfoFromMessageData:message.data];
    if ([self checkLocation]) {
    UIAlertController *confirmNotification = [UIAlertController alertControllerWithTitle:@“Order Detail” message:[messageInfo objectAtIndex:4] preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction *cancelButton = [UIAlertAction actionWithTitle:@“Cancel” style:UIAlertActionStyleCancel handler:nil];
    [confirmNotification addAction:cancelButton];
    UIAlertAction *acceptAction = [UIAlertAction actionWithTitle:@“Accept” style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
    [self respondFromMessage];
    }];
    [confirmNotification addAction:acceptAction];
    [self presentViewController:confirmNotification animated:YES completion:nil];
    }
    }
    }
    } subscriptionError:^(Fault *error) {
    NSLog(@“subscribe (ERROR): %@”, error.message);
    } response:^(BESubscription *response) {
    NSLog(@“subscribe: SUBSCRIPTION: %@”, response);
    } error:^(Fault *fault) {
    NSLog(@“subscribe FAULT: %@”, fault.message);
    }];
    }
    }

Hi Kadik,

Please use the code generation feature available in Backendless console and see how the code works there. To do this:

    Click Code Generation in console Select iOS Select Publish/Subscribe (sample chat) Click Download Project
Mark

Thank you for responding.