2
我正在使用AFNetworking
的Web服務。它在NSURLConnection
上工作正常。它使用AFNetworking
給出錯誤。錯誤域= AFNetworkingErrorDomain代碼= -1011「請求失敗:方法不允許(405)」
這裏是我的代碼:
AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithBaseURL:baseURL];
manager.responseSerializer = [AFJSONResponseSerializer serializer];
[manager POST:@"" parameters:parameters success:^(NSURLSessionDataTask *task, id responseObject) {
NSLog(@"Succes");
} failure:^(NSURLSessionDataTask *task, NSError *error) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error Retrieving Weather"
message:[error localizedDescription]
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alertView show];
}];
這是我收到的錯誤:
Error Domain=AFNetworkingErrorDomain Code=-1011 "Request failed: method not allowed (405)" UserInfo=0x1e86b390 {NSErrorFailingURLKey=http://..............url.........., AFNetworkingOperationFailingURLResponseErrorKey=, NSLocalizedDescription=Request failed: method not allowed (405)}.
能否請您爲這方面的幫助。
非常感謝。它工作正常。 –