Table of Content
Defining block method argument
Here is an example that define a block argument to a method which fetches JSON.
1- (void)updateNewsDataSuccess: (void (^)(NSArray* data))successFeedback { 2 AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; 3 [manager GET:@"http://api-server/resources.json" 4 parameters:nil 5 success:^(AFHTTPRequestOperation *operation, id responseObject) { 6 // your logic here to manipulate the fetched data 7 8 successFeedback(data); 9 } 10 failure:^(AFHTTPRequestOperation *operation, NSError *error) { 11 // fail code 12 }]; 13}