AFHTTPClientに奇妙な問題があり、POSTリクエストを次のように送信しています
NSURL *u = [NSURL URLWithString:HTTP_SERVER];
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL: u];
[httpClient setParameterEncoding:AFJSONParameterEncoding];
[httpClient postPath:REGISTER
parameters:params
success:^(AFHTTPRequestOperation *operation, id JSON) {
int statusCode = [operation.response statusCode];
if(statusCode == 201){
[self performSegueWithIdentifier:@"register" sender:self];
}
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"[HTTPClient Error]: %@", error.localizedDescription);
}];
サーバーは正常に動作します (場合によっては、サーバーがコード 409 で応答する必要があります。API はそのように作成されます)、XCode Expected status code in (200-299), got 409
でエラーが発生します。 ) ?