What is the User Agent string for Apple TVs running the new Apple tvOS operating system (which I believe is based on iOS)? Do they report themselves as being "iOS" devices?
3 Answers
The Apple TV does not support the WebKit framework, meaning you can't technically show webpages and therefore have a User Agent.
However, if you somehow had it running one the new TVOS, the User Agent would definitely be :
Mozilla/5.0 (Apple TV; CPU iPhone OS 9_0 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13T534YI

- 2,904
- 1
- 13
- 23
I didn't see any official documentation on this, but a number of people have reported the user agent for tvOS being something a long the lines of:
[AppName]/1 CFNetwork/758.1.6 Darwin/15.0.0
[AppName]/1 CFNetwork/758.1.2 Darwin/15.0.0
I have seen something similar. Here is mine:
[AppName]/1 CFNetwork/758.2.8 Darwin/15.2.0
Note: These User Agents can change.
You can check for yourself using a HTTP proxy and monitor, such as Charles. Also mentioned here on SO.
Sources:

- 1
- 1

- 1,801
- 1
- 17
- 26
tvOS does not currently (as of October, 2017) expose any web view components (such as UIWebView
) in its SDK. However, you can still force tvOS to load UIWebView
using reflection (see answer here), and then extract user agent string from it.
let webViewClass: AnyObject.Type = NSClassFromString("UIWebView")!
let webViewObject: NSObject.Type = webViewClass as! NSObject.Type
let webView: AnyObject = webViewObject.init()
let userAgent = webView.stringByEvaluatingJavaScript(from: "navigator.userAgent")
print(userAgent!)
Output:
Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Mobile/15J380

- 1,596
- 1
- 15
- 19
-
This solution works, but the output is describing it as iPhone instead of AppleTV – John Lima Jun 24 '22 at 19:58