views:

50

answers:

1

When I make a request to a particular website, I get the XML response as desired on the simulator but I get a redirect page on the device. I think this is because it is detecting that I am using a mobile browser (similar results occur through Mobile Safari), but I'm setting the user agent string of the request to my laptop browser's UA and blanking the rest (I've also tried setting just the UA):

NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]                        
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:60.0];
[request setAllHTTPHeaderFields:[NSDictionary dictionaryWithObject:@"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.11) Gecko/20101012 Firefox/3.6.11" forKey:@"User-Agent"]];
NSURLConnection* _connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];

How could the website still be detecting that I'm using a mobile browser? The same GET works through telnet with zero information, which implies that the default response is the desktop version.

A: 

Turns out Mobile Safari will automatically redirect/renegotiate http->https in the simulator, but won't do it on the device.

huge sesh