TVMLKitErrorDomain error 3

Can anyone tell me what this error means and how I fix it? I have an app running on the simulator just fine with the recommended local host of 9001, but when I try to push the app to my Apple TV, it starts up and I get the message:

TVMLKitErrorDomain error 3.


Any help with this would be greatly appreciated. I cannot figure out why it works great on the simulator but not on the device!

Accepted Reply

TVMLKitErrors.h is your friend 😉


In this case, the TVApplicationController failed to launch because it wasn't able to fetch your application JavaScript, evaluate it and start the TVMLKit based application.

Replies

I encountered the same error when there was no connection to my remote javascript files host, your tv device is not the same localhost as your simulator localhost, you should access the js files host by ip and make sure they both on the same network

That error indicates that your application js file failed to load. I beleive that you might still be using localhost path in your swift code, which will work fine in simulator, as both simulator and the localhost is running on the same machine. However, when you deploy the app to the Apple TV device, it will never be able to find localhost.


You simply need to host your entire client app somewhere in the cloud and then give the path of the hosted files. An other alternative would be to connect both your Apple TV and your machine to the same network and host your client app publicly in the local network. You can then provide your machine IP address as the path. On mac you have pre-installed apache so you can do something like below to host it within your local network.


// start your apache server from the terminal

sudo apachectl start

// then check whether you are able to access your webserver

// go to browser and type your ip address (you can check your ip in the network settings in System Preferences)

// by default you should see a page with content "It Works!"

Your files are by default available at this location, /Library/WebServer/Documents and you can put all your client code in this place. Then test the paths in your browser by hitting your IP address and the relative paths. If all works well, specify the same path in your Apple TV native code and deploy it to the actual device and test (make sure that both your device and your machine are connected to the same network).

I got this with the latest 7.3.1/ tvos 9.2 sdk. By default now, you have to opt in to non-HTTPS requests. Adding this to the Info.plist solved it for me:


<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

Silly question:

Are you pointing to localhost:9001 or to your Ip address? like 192.168.0.10:9001

Thanks for this answer... I was running the default 'Hello World' starter template for TVMLKit in XCode 7.3.1 and I couldn't understand why the default project, without any modifications (and with localhost running successfully already) wouldn't function without seeing 'Error 3'. I added those items to Info.plist and suddenly it work. Cheers for the knowledge!

TVMLKitErrors.h is your friend 😉


In this case, the TVApplicationController failed to launch because it wasn't able to fetch your application JavaScript, evaluate it and start the TVMLKit based application.