I'm trying to send a REST API to my AFNetworking2.0 server, our server accepts Content-Typehow application/vnd.mycom.mycom-csc+json, when I send a request, this is really a json format,
self.operationMgr = [AFHTTPRequestOperationManager manager];
self.operationMgr.securityPolicy.allowInvalidCertificates = YES;
operationMgr.responseSerializer = [AFJSONResponseSerializer serializer];
operationMgr.requestSerializer = [AFJSONRequestSerializer serializer];
self.operationMgr.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"application/vnd.mycom.mycom-csc+json"];
[self.operationMgr.requestSerializer setValue:@"application/vnd.mycom.mycom-csc+json" forHTTPHeaderField:@"Accept"];
[self.operationMgr.requestSerializer setValue:@"application/vnd.mycom.mycom-csc+json" forHTTPHeaderField:@"Content-Type"];
[self.operationMgr POST:@"https://ip/rest" parameters:body
success:^(AFHTTPRequestOperation *operation, id responseObject) {
}
failure:^(AFHTTPRequestOperation* task, NSError* error){
NSLog(@"Error: %@", error);
}];
but it does not work, Content-Typealways changes to application/jsonin my request, who can help solve this problem? many thanks.
source
share