Question

I would like to use the following curl request in AFNetworking 2.0. Any ideas how I would go about this?

curl --request POST -d "login=remitest&password=password&api_version=3" https://8tracks.com/sessions.json
Was it helpful?

Solution

Try this:

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
                        @"remitest", @"login",
                        @"password", @"password",
                        @3, @"api_version",
                        nil];
[manager POST:@"https://8tracks.com/sessions.json" parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) {
    // do your stuff
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    // fail cases
}];

Hope it helps

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top