2014-12-03 6 views
0

Я пытаюсь сделать вложенный блок внутри другого блока. Похоже, что асинхронные запросы быстро уходят на iOS8 в отличие от предыдущей версии iOS. Вот мой Анализировать код:не может инициировать вложенный блок на iOS8

- (void)getRemoteImageAndSaveLocalWithObjectId:(NSString *)objectId andType:(NSString *)type{ 
    if ([type isEqualToString:@"user"]) { 
     PFQuery *query = [GAUser query]; 
     //[query includeKey:@"userImage"]; 
     [query getObjectInBackgroundWithId:objectId block:^(PFObject *object, NSError *error) { 
      GAUser *gaUser = (GAUser *)object; 
      PFFile *userImageFile = gaUser[@"@userImage"]; 

      [userImageFile getDataInBackgroundWithBlock:^(NSData *data, NSError *error) { 

       // I am never able to get inside this block of code. 
       NSLog(@"in get data"); 
       if (!error) { 

        NSLog(@"remote image name: %@",data.debugDescription); 

        UIImage *image = [UIImage imageWithData:data]; 


       }else{ 

        NSLog(@"there was an error"); 
       } 
      }]; 


     }]; 
    } 

} 

Кто-нибудь знает, почему я не могу получить в getDataInBackgroundWithBlock блоке?

+2

Является ли 'userImageFile' nil? – Darren

+1

Это ноль или не PFFile – Andy

ответ

0

Даррен и Энди были правы (они, вероятно, братья).

userImageFile был ноль, и в этом была проблема.