Search code examples
swiftxcodewebviewwebkittvos

How to display webpages in tvos using webkit


I was trying to submit my web based app to apple app store for tvOS, and they basically say that you should use webkit/webkitjs for web content. however, when I try to run a sample app; webkit doesn't load on apple tv. Now, I think I also read somewhere that apple tv doesn't support webkit. So, does tvOS support webkit? And id so, then why can I not find any help on displaying webpages in tvOS? The only help available is from many years ago which is also not applicable right now.


Solution

  • Sorry to be the bearer of bad news, but UIWebView / WebKit et al are forbidden on tvOS. If you try to use any workarounds (editing Availability.h etc) You will still be stopped cold when submitted to the AppStore. The only option I've ever gotten working is using UIWebView, which is deprecated, but it's a subpar experience. If you want to see it in action there are example projects on github to make a basic "tvOS Browser" https://github.com/search?q=tvosbrowser

    If you think about it, it makes sense. The tv isn't a touch screen environment so you revert to the mouse pointer paradigm with a siri remote (or game controller, etc) to navigate the views. Its not a pleasant experience.