我正在使用 AFNetworking 共享客户端向 REST 服务器发出请求。
我的删除代码是:
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 请求工作正常,但 DELETE 请求有问题。我哪里错了?