-
Notifications
You must be signed in to change notification settings - Fork 195
Description
For some reason, when using RNCachingURLProtocol together with AFNetworking, all my POST requests (JSON) to the API by AFNetworking stopped working. Took me a while to find out that RNCachingURLProtocol was interfering with it at some point.
Once I removed RNCachingURLProtocol, the API started working again.
All my POST requests were getting to the API as GET requests.
This is the code I was using:
AFHTTPRequestOperationManager *manager = [[AFHTTPRequestOperationManager alloc] init];
[manager setRequestSerializer:[AFJSONRequestSerializer serializer]];
[manager.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[manager.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[manager POST:serverURL parameters:parametersDict success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"JSON: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];