ios - POST with AFNetworking, error code -1001 -
i want post json message send server. don't have access server know working , set return success/failure message when message gets through. server requires app id , password connect
i using afnetworking this. here code i'm using:
nsurl* pushserverurl = [nsurl urlwithstring: @"http://myserverurl.com/"]; afhttpclient* networkinstance = [[afhttpclient alloc] initwithbaseurl: pushserverurl]; nsdictionary *parameters =[nsdictionary dictionarywithobjectsandkeys: @"myappid", @"app_id", @"mypassword", @"password", nil]; nsdictionary *params =[nsdictionary dictionarywithobjectsandkeys: parameters, @"user", nil]; [networkinstance postpath: @"users/login.json" parameters: params success:^ (afhttprequestoperation *operation, id jsonresponse) { nslog (@"success"); } failure:^ (afhttprequestoperation *operation, nserror *error) { nslog(@"failed"); }];
it fails error code -1001.
the nserror has 4 keys in user info
nserrorfailingurlstringkey value @"http://myserverurl.com/, nserrorfailingurlkey value <not objective-c object>, nslocalizeddescription value "the request timed out" nsunderlyingerror , value has no string.
any idea might doing wrong?
try line of code. can find response coming server or else, actual problem is?
[networkinstance postpath: @"users/login.json" parameters: params success:^(afhttprequestoperation *operation, id jsonresponse) { nslog (@"success"); } failure:^(afhttprequestoperation *operation, nserror *error) { nslog(@" error - statistics file upload failed: \"%@\"", [request error]); }];
Comments
Post a Comment