我想在AFNetworking 2.0中使用以下curl请求。有什么想法我会怎么做?
curl --request POST -d "login=remitest&password=password&api_version=3" https://8tracks.com/sessions.json
答案 0 :(得分:2)
试试这个:
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
}];
希望有所帮助