I have had a 3rd generation Apple TV for a few years now. I loved it! It worked extremely well for watching Netflix and mirroring the screen from an Apple device, but it did not allow any third party applications for a very long time. Until Apple TV 4 has been announced along with tvOS. I was super excited! I purchased the Apple TV as soon as I had the opportunity to, but never really had a chance to write an app for it. Until a couple of weeks back.
Project Idea
The idea was very simple. We have a TV installed right above our team. Unfortunately, the information displayed on that TV is not very valuable for our team, so I thought it would be cool to implement an application with a very simple user interface, which would allow anybody to change the content displayed on that TV. My idea was to create two applications. The first application would run on the Apple TV, which would download a list of web addresses from a back end and then loop through those addresses. The second portion would be a web app, which would allow people to modify the list of the addresses picked up by the TV.
My idea was to use a single view controller with a WebView in it, a timer running in a loop, and Firebase SDK to subscribe to the real-time database with a list of addressed. It didn’t quite work.
USB C
I hit my first road block when I have tried to connect the Apple TV to my Mac, just to realise that instead of using a lightening port Apple decided to use a USB C port. Don’t get me wrong. I have nothing against USB C. I just don’t understand why Apple decided to put it here. Most of the iOS devices come with a lightning port. The Apple TV remote controller is charged through a lightning port, the Apple TV comes with a lightning cable in the box, so why USB C on the device itself? After finding the cable, I started writing the application, just to see that…
tvOS does not allow to use UIWebView
UIWebView is disallowed. It is there, it is functional, it works in very much the same way as UIWebView for iOS, but the application is not compiling if you try to reference it. As I wasn’t planning to release the application to the App Store I had to find a way around it, which I did here.
To some degree, I can understand why Apple decided to do this. I think they were worried that the App Store would be filled with applications which don’t have anything else, but a wrapper around their responsive website. But completely removing UIWebView from the operating system is a bit silly in my opinion. How does one suppose to implement OAuth? Well, I have hacked around it, so moving on.
Firebase is not compatible with tvOS
Argh… StackOverflow is talking about a beta version of the SDK available, but not publicly. I have tried to “hack” my way around this, without any luck. I have attempted to find a similar back-end solution but didn’t want to spend hours researching, so I gave up on this idea as well.
At the end, I decided to use the company’s wiki page as a “backend.” The idea was that my app would load the wiki page every so often and parse the list of links from there. Every user already has access to the Wiki, and they don’t need to learn how to use it, so in some way, that solution was probably even better, but…
The Wiki page is password protected
I have added a very hacky JavaScript logic to log into the wiki page. It wasn’t pretty but worked well for the demo version of the application.
The results
I built the project within a day. It is not very pretty, but it is functional.
Building the application icon was a lot of fun! The designer had to supply three different images, which I “plugged into” Xcode to get a very cool 3D effect.
Working with the remote controller was harder than I expected it to be. Not that it took me very long, but I was hoping to see a more explicit interface for the main way for the users to interact with the application.
The documentation is rather poor. I had to rely on StackOverflow more than I’d like to for the first experience with the platform.
Overall, I don’t think I will be writing more apps for tvOS anytime soon. The use cases seem to be rather limited, so I’m not sure if it will be very popular beyond video games and video streaming services.
Recent Comments