views:

69

answers:

1

I've got a problem working with one remote server. My app makes a request to a server using [NSData initWithContentsOfURL:] method and as a response I get website's url which I open in UIWebView.

The problem is that those requests have different User-Agent and server can't serve me correct because it expects that I send all requests with the same User-Agent. I know how to change User-Agent (e.g Change User Agent in UIWebView (iPhone SDK)) but what I really want it is somehow to get UIWebView's User-Agent and set it to [NSData initWithContentsOfURL:] to avoid problems with server side

+1  A: 

What about this one http://blog.sallarp.com/iphone-ipad-get-user-agent-for-uiwebview/ ?

Open SEO
Interesting. I have solved the problem with an extra request to server but this solution is much more elegant. I'll check if it returns what I want.
Dmytro
I have not succeeded to put it to work. _User-Agent_ is always *nil*
Dmytro