나는 GET을 여러 번 사용했습니다. 하지만 현재 상황에서는 POST 메서드를 사용하여 webService를 사용해야합니다. 나는 많은 자습서를 통과했지만 할 수 없었다. 경로가 "http://vinipost.com/Services/Mobile_Application/wcfService.svc/logIn"이고 4. 기본값은 테스트를위한 이메일 ID가 "ID"와 "패스"입니다 "[email protected]"이고 암호는 "만세"AFnetworking 또는 NSJsonialialization을 사용하여 json 데이터를 게시하는 방법
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:@"http://vinipost.com/Services/Mobile_Application/wcfService.svc/logIn"]];
[httpClient setParameterEncoding:AFFormURLParameterEncoding];
NSMutableURLRequest *request = [httpClient requestWithMethod:@"POST" path:@"http://vinipost.com/Services/Mobile_Application/wcfService.svc/logIn" parameters:@{@"id":@"[email protected]",@"pass":@"shail"}];
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
self.movies = [JSON objectForKey:@"logInResult"];
NSLog(@"=========%@",self.movies);
} failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON) {
NSLog(@"Request Failed with Error: %@, %@", error, error.userInfo);
}];
[operation start];
OUTPUT
=========(
{
msg = "Server encountered error";
}
)
입니다
서버 측 사람은 "MSG = 서버 오류가 발생했습니다"를 인쇄하는 이유는 catch 블록 이잖아 체결 말하고
내 의견에 정교하게, 그리고 아마도 방법 다운 가능 추적하는 몇 가지 힌트를 제공 할 것이다
실제 문제가 무엇인지 말하면 정말 도움이 될 것입니다. 게시 할 수 없습니까? 아니면 오류가 다시 발생합니까? 오류가 무엇입니까? –
@ MichaelDautermann- 문제는 바로 응답을 다시 얻지 못한다는 것입니다. –
서버 쪽 사람이 catch 블록에 들어간다 고 말합니다. "msg = 서버에 오류가 발생했습니다" –