Open zicjin opened 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?
You solved this problem yet , I also encountered the same problem? ? I write it only where i use it How did you solve it? ?
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.
ok thanks I will try
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.