2013-01-23 110 views
0

我正在使用AFNetworking共享客戶端向REST服務器發送請求。DELETE請求時,服務器發出錯誤請求

我的刪除代碼是:

NSMutableDictionary* params = [[NSMutableDictionary alloc] init]; 
[[ApiClient sharedClient] deletePath:[NSString stringWithFormat:@"users/%@/venues/%@/", appDelegate.currentUser.userId, venue.venueId] parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) { 
    NSLog(@"venue deleted from saved"); 
} failure:^(AFHTTPRequestOperation *operation, NSError *error){ 
    NSLog(error.description); 
}]; 

當我配置客戶端,我加入:

[self registerHTTPOperationClass:[AFJSONRequestOperation class]];  
[self setDefaultHeader:@"Accept" value:@"application/json"];  
[self setDefaultHeader:@"Content-Type" value:@"application/json"];  
[self setParameterEncoding:AFJSONParameterEncoding]; 

POST請求工作正常,但與刪除請求的問題。我錯在哪裏?

回答

0

您需要查看錯誤並檢查發生了什麼問題。如果錯誤沒有幫助,那麼您將需要使用代理(可能爲Charles),並確切瞭解請求發生了什麼以及服務器爲什麼不喜歡它。