Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zicjin opened this issue Aug 14, 2014 · 4 comments

Comments

@zicjin
Copy link

zicjin commented Aug 14, 2014

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
Copy link
Author

zicjin commented Aug 14, 2014

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
Copy link

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
Copy link

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
Copy link

ok thanks I will try

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants