Answer the question
In order to leave comments, you need to log in
How to get response from server using AFNetworking (Obj-C)?
I decided to deal with AFNetworking and created a simple console application that contains only one POST request of this kind:
AFHTTPRequestOperationManager *operationManager = [AFHTTPRequestOperationManager manager];
[operationManager POST:@"http://maps.google.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"JSON: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
Answer the question
In order to leave comments, you need to log in
The problem is that when return 0; is called; in the main function, the application terminates. And since in afnetworking the request is asynchronous, it simply does not have time to work.
Make an application with one controller / window and paste the code there
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question