Search code examples
iosios8restkit

Restkit is freezing


I have some bug under iOS 8 that freezes my iPhone app. During loading data from the backend by using RestKit I don't know why the code in the :getObjectsAtPath method is not executed. I'm assuming that there should be returned code from the success or failure block of this method. It looks like the rest kit is trying to get data from the backend as I can see that network activity indicator spinner is still active. I have no idea how could I possibly investigate the issue because the Xcode does not return any error. The app is still working but I can't tap on the back button to jump to the parent view.

-(void)loadAlerts{
_credentials = [[EFCredentials alloc]init];

NSString *rememberToken = [_credentials authToken];

if ([EFReachabilityManager isReachable]) {


    [[[RKObjectManager sharedManager]HTTPClient]setDefaultHeader:@"Authorize" value:rememberToken];

    RKResponseDescriptor *responseDescriptor =
    [RKResponseDescriptor responseDescriptorWithMapping:[EFMappingProvider alertsMapping]
                                                 method:RKRequestMethodGET
                                            pathPattern:[NSString stringWithFormat:@"/%@/alerts.json",_id]
                                                keyPath:nil statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];

    [[RKObjectManager sharedManager]addResponseDescriptor:responseDescriptor];

    [[RKObjectManager sharedManager] getObjectsAtPath:[NSString stringWithFormat:@"/wearers/%@/alerts.json",_wearer_id] parameters:nil


                                              success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult){

                                                  NSLog(@"%@",mappingResult.array);

                                                  [self.tableView reloadData];


                                              }

                                              failure:^(RKObjectRequestOperation *operation, NSError *error) {



                                                  UIAlertView *alertView =
                                                  [[UIAlertView alloc] initWithTitle:@"Error" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];

                                                  [alertView show];
                                              }
     ];
}
else{

    _alertViewReachability = [[UIAlertView alloc]initWithTitle:@"Error" message:@"No network connection " delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Try again", nil];
    [_alertViewReachability show];
}

}

enter image description here

libsystem_kernel.dylib`semaphore_wait_trap: 0x196954eb0: movn x16, #35

0x196954eb4: svc #128

0x196954eb8: ret


Solution

  • It looks like possible deadlock. The refreshData: method in EFAlertsHistoryTVC is responding to a notification. Perhaps something in that method is waiting synchronously for data that won't be available until the method returns.