I know there may be several issues about this, but i´m facing a problem when i try to set a new "user agent" for my UIWebView. Here is what i am doing right now:
NSURL *myUrl = [NSURL URLWithString:auxUrl];
NSMutableURLRequest *myRequest = [NSMutableURLRequest requestWithURL:myUrl];
NSMutableString *auxUserAgent = [[NSMutableString alloc] initWithString:[myRequest valueForHTTPHeaderField: @"User-Agent"]];
[auxUserAgent appendString:@"(iOS)"];
[myRequest setValue:auxUserAgent forHTTPHeaderField:@"User-Agent"];
NSLog(@"UA : %@",[myRequest valueForHTTPHeaderField: @"User-Agent"]);
I am trying to append some text to the actual user agent, and in the XCode console it does show the new user agent value.
2013-12-16 19:03:42.200 App[736:60b] UA : Mozilla/5.0 (iPhone; CPU iPhone OS 7_0_4 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Mobile/11B554a(iOS)
But when i run my App, it shows the old one. Here is a screenshot of the user agent shown in the web page i am showing in the UIWebView:
So.. my questions are: What am i missing?? is there something in the system that doesn´t allow developers to change this data??
Thank you.
@"User-Agent"
instead of@"User_Agent"
? – Picaroon