Last active
August 29, 2015 14:05
-
-
Save meigesir/7bfc8099468a8b6649d1 to your computer and use it in GitHub Desktop.
A demo for AFNetworking 2.3 request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; | |
manager.requestSerializer = [AFJSONRequestSerializer serializer]; | |
[manager.requestSerializer setValue:[RCPreferences privateToken] forHTTPHeaderField:@"AUTHORIZATION"]; | |
NSString *api = [NSString stringWithFormat:@"https://*/api/users/%@.json", aId]; | |
// POST: just change "GET" to "POST" | |
[manager GET:api parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { | |
debugLog(@"result: %@", responseObject); | |
// success... | |
} failure:^(AFHTTPRequestOperation *operation, NSError *error) { | |
debugLog(@"error: %@", error); | |
// failure... | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment