我使用AFNetworking庫下面的請求參數如何通過AFnetworking發送郵件請求?
{
"method":"validate",
"name":{
"firstname":"john",
"lastname":"doe"
}
}
瞭如何使用最新版本AFNetworking V3庫的這一要求作出POST請求?
我用下面的代碼,它不工作
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:configuration];
[manager setRequestSerializer:[AFJSONRequestSerializer serializer]];
[manager setResponseSerializer:[AFJSONResponseSerializer serializer]];
NSDictionary *parameters = @{\"method\":\"validate\",\"name\":{\"firstname\":\"john\",\"lastname\":\"doe\"}};
[manager POST:@"http://myUrl.." parameters:parameters success:^(NSURLSessionDataTask *task, id responseObject) {
NSLog(@"%@",[responseObject description]);
} failure:^(NSURLSessionDataTask *task, NSError *error) {
NSLog(@"%@",[error localizedDescription]);
}];
即時得到下面的錯誤,
2016-02-13 11:04:54.085 SlideOutMenu[3698:50453] nulllllll
2016-02-13 11:04:55.794 SlideOutMenu[3698:50453] Failure Request failed: internal server error (500)
2016-02-13 11:04:55.795 SlideOutMenu[3698:50453] (null)
你嘗試過什麼嗎? –
我確信有足夠的指導可用於AFNetworking ....但如果你沒有閱讀它比檢查https://github.com/AFNetworking/AFNetworking/wiki/AFNetworking-3.0-Migration-Guide –
是的,我已經更新我的問題與我所嘗試的。 –