rnapier / RNCachingURLProtocol

Simple offline caching for UIWebView and other NSURLConnection clients
940 stars 198 forks source link

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

Open zicjin opened 10 years ago

zicjin commented 10 years ago

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 commented 10 years ago

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?

freedomct commented 9 years ago

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

yupliang commented 8 years ago

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.

freedomct commented 8 years ago

ok thanks I will try