I am following this tutorial to learn AfNetworking
in IOS
And I am using the following function to get the response from the server:
For example, I have one method which returns a value:
{
__block id response = [[NSDictionary alloc]init];
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager GET:URLString parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
response=responseObject;
NSLog(@"JSON: %@", response);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
NSLog(@" return Dic ==> %@",response);
return response;
}
What I want is to write a function which will returns the response as a NSDictionary
after getting response. I don't know the syntax.Can anybody help me ?
Sure... you probably don't need to declare the NSDictionary as a block object though: