나는이 모든 것을 조사해 왔으며이를 파악하지 못했습니다. 내가 본 JSON 예제 중 URL에 메소드 이름이 없으므로 문제가 될 수 있습니다.iOS JSON 인증 토큰 요청에 매개 변수가 누락되었다고 말합니다.
NSString *username = @"xxxx";
NSString *password = @"xxxx";
NSString *loginURL = @"http://www.xxxxxx.com/services/api/rest/json?method=xxxxxx.auth.gettoken";
NSURL *url = [NSURL URLWithString:loginURL];
NSString *JSONString = [NSString stringWithFormat:@"{\"username\":\"%@\",\"password\":\"%@\"}", username, password];
NSData *JSONBody = [JSONString dataUsingEncoding:NSUTF8StringEncoding];
NSMutableURLRequest *loginRequest = [[NSMutableURLRequest alloc] initWithURL:url];
loginRequest.HTTPMethod = @"POST";
loginRequest.HTTPBody = JSONBody;
NSOperationQueue *queue = [NSOperationQueue new];
[NSURLConnection sendAsynchronousRequest:loginRequest
queue:queue
completionHandler:^(NSURLResponse *response, NSData *data, NSError *error){
// Manage the response here.
NSString *txt = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
NSLog(@"%@", txt);
}];
내가 SquidMan와 나는를 사용하여 reuest를 스누핑하고 발견하는 액세스 로그리스트 : 여기 내 코드입니다 www.xxxxx.com/services/api/rest/json? - DIRECT/..... 메서드 이름이 없지만, SquidMan을 처음 사용하는 것이지만 거기에있을 것이라고 가정합니다.
메시지가 돌아 오면 매개 변수 사용자 이름이 누락되었습니다.
미리 감사드립니다.
제안을 주셔서 감사합니다. 여전히 작동하지 않습니다. 누락 된 매개 변수 반환 값과 동일합니다. 내 제안에 당신의 제안을 남길 것이다. – crt79