回答

3

你可以打電話給你的選擇完成區塊內:

AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:urlRequest 
     success:^(NSURLRequest *completedURLRequest, NSHTTPURLResponse *response, NSDictionary *json) { 
      [self callMyCustomSuccessMethod:json]; 
     } 
     failure:^(NSURLRequest *errorRequest, NSHTTPURLResponse *response, NSError *error, id JSON) { 
      [self callMyCustomErrorMethod:error]; 
     }]; 
[operation start]; 
2

不知道AFHTTPRequestOperation支持基於選擇-回調,但你可以很容易地換一個電話你選擇在一個塊:

success:^(AFHTTPRequestOperation *operation, id responseObject) { 
    [myDelegate onSuccess:operation]; 
} 

這將適用於下列聲明的回叫方法:

- (void)onSuccess:(AFHTTPRequestOperation*)operation; 
相關問題