RNCachingURLProtocol icon indicating copy to clipboard operation
RNCachingURLProtocol copied to clipboard

AFHTTPRequest's all request will be GET method after register RNCachingURLProtocol

Open zicjin opened this issue 11 years ago • 4 comments

didFinishLaunchingWithOptions add: [NSURLProtocol registerClass:[RNCachingURLProtocol class]]; then: AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; [manager POST:@"http://domain.com" parameters: …… success:…… ] this request will be GET method type.

when annotation 「[NSURLProtocol registerClass:[RNCachingURLProtocol class]];」,AFHTTPRequest is successful.

zicjin avatar Aug 14 '14 03:08 zicjin

can i register RNCachingURLProtocol before UIWebView init,and unregister it before ViewController's [self dismissViewControllerAnimated:YES completion:nil] ?

this solution will destroy RNCachingURLProtocol's cache?

zicjin avatar Aug 14 '14 04:08 zicjin

You solved this problem yet , I also encountered the same problem? ? I write it only where i use it How did you solve it? ?

freedomct avatar Oct 01 '15 07:10 freedomct

this code may help,in you afhttprequest add the below code [request setValue:@"YES" forHTTPHeaderField:@"iSAFNetwork"]; then in RNCachingURLProtocol.m in the method "+ (BOOL)canInitWithRequest:(NSURLRequest *)request" try to get the value :[request valueForHTTPHeaderField:@"iSAFNetwork"],if you get the value then return NO, don't use this protocol to handle it.

yupliang avatar Jan 13 '16 08:01 yupliang

ok thanks I will try

freedomct avatar Jan 13 '16 08:01 freedomct