How to add a custom header field to every request made by my UIWebView
I want to add a custom header field to every request made by my UIWebView. First I tried to do this in the "shouldStartLoadWithRequest" method in my controller, but this only works for the first request made - all subsequent requests are not handled by this method.
After some search, I found this tutorial (http://eng.42go.com/customizing-uiwebview-requests-with-nsurlprotocol/). So I implemented my own NSURLProtocol subclass, and everthing is working fine, except my login page - there is some problem with authentication, and I could not solve this. I saw that there exists some methods like "canAuthenticateAgainsProtectionSpace" and "didReceiveAuthenticationChallenge", and I probably need to implement these in order to my login page to work. However, this seems a lot of additional work, since in the first place I just wanted to add a field to every request.
So my doubts are:
Thanks!
链接地址: http://www.djcxy.com/p/34754.html