This blog is mainly dedicated to the iPhone and iPad programming as well as informations about our applications
UIWebView provides no way to change the User-Agent.
And not only it doesn't provide anything to change it, but it also override this value when we try to set the User-Agent in a NSMutableURLRequest object passed as a request in the loadRequest UIWebView method.
There are some solutions i found on the web that works but none are perfect :
One solution is to set User_Agent instead User-Agent in a NSMutableURLRequest.
That works for many websites but not all because setting User_Agent doesn't override User-Agent, that just adds another header value called User_Agent that some website uses instead of User-Agent.
Another solution that works well is to use method swizzling in the NSMutableURLRequest class to watch when the User-Agent is set and override the value to have the desired User-Agent.
The problem with this method is that is not very easy to implement and method swizzling can be dangerous if we are not careful with this.
The other problem is that Apple can reject your application if it uses method swizzling.
So i found (with luck) a solution which is simple, without using method swizzling and which overrides the true User-Agent (not User_Agent).
Here is the class method to add to your main controller (or app delegate) :
it works perfectly!
I was struggling to find a good way to do this for android as well. This is what I've found
Really simple way is to fetch the...
I think this board is the proper place to ask you about the activation proccess. My link is not working properly, do you know why it is...
You can put what you want in the desired user agent.
Yes it's "UserAgent", there is no typo, but don't forget that you need to set...
Can you give us a sample of what belongs in "Desired User Agent?" I'm using:
Mozilla/5.0 (iPhone Simulator; U; CPU iPhone OS 4_2...