Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS8 Simulator user agent

While investigating why I have a bug on iOS8 webview I discovered that WebView's User-Agent is:

Mozilla/5.0 (iPhone; CPU iPhone OS 10_9_5 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12A365 (2072607680)

Whereas since I'm running for iOS8, it rather should be:

Mozilla/5.0 (iPhone; CPU iPhone OS 8_0_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12A405kalturaNativeCordovaPlayer (350612576)

Of Course there's no iPhone running version 10.10 as yet, so Xcode6 is somehow picking up version from Mac OS X. For iOS < iOS8 simulators, it works just fine.

So do you have a solution for me how to discover if it's iOS8 simulator or not

For now this is my javascript method:

isIOS8 = function(){
    return ( /OS 8_/.test( userAgent ) || /Version\/8/.test( userAgent ) ) && isIOS();
};
like image 773
ElizaS Avatar asked Oct 05 '14 08:10

ElizaS


1 Answers

This issue was fixed in the iOS 8.3 Simulator Runtime. That version and newer versions do not suffer from this issue any more.

I suggest you look for the "iPhone OS" and "AppleWebKit/600.1.4" substrings if you really need to determine that you're running on iOS 8, but you should probably not be approaching the problem this way. Instead, you're probably better off making a determination based on capabilities rather than version numbers.

like image 167
Jeremy Huddleston Sequoia Avatar answered Oct 29 '22 10:10

Jeremy Huddleston Sequoia