Chris Chris - 4 months ago 208
Swift Question

Using Firebase with tvOS

When I try to use the Firebase framework with tvOS (via cocoapods) I get the following error:

Target 'Pods-Portal TV' of project 'Pods' was rejected as an implicit dependency for 'Pods_Portal_TV.framework' because it doesn't contain platform 'appletvsimulator' in its SUPPORTED_PLATFORMS 'iphonesimulator, iphoneos'


I 'tricked' cocoapods to install the framework due to it not recognizing tvOS as a supported platform, by declaring the target as
:ios
.

So it's easy to see what the problem is. My question: Is it possible to work around this until Firebase officially supports tvOS?

Answer

Ok, so I got it working, albeit, a bit flaky.

This is a very quick guide as to how, at the time of writing.

First you need to setup CocoaPods to use unreleased features and get the master branch of cocoapods / cocoapods-core

Then you need to create a private spec repo or use mine

Remember to set your xcode path to your beta version of xcode sudo xcode-select -s /Applications/Xcode-Beta.app/Contents/Developer otherwise the spec won't build.

Then set your source to your spec file, and set the platform to platform :tvos, '9.0' in your Podfile, then pod install.

Your Project should then build and run, but with about 155 warnings:

ld: warning: URGENT: building for tvOS simulator, but linking in object file (/Users/..../..../.... /tvOS/Pods/Firebase/Firebase.framework/Firebase(FPendingPut.o)) built for iOS. Note: This will be an error in the future.

So obviously not a solid solution. Definately not a production solution. But hopefully Firebase will add support in the future. I spoke to Frank from the Firebase team who said that he will take it up at the next feature discussion to see if they want to include it. Here's to hoping they will :)

Also, I had to Comment out the Accounts/Accounts.h import statement in the FAuthData.h for some reason? I don't know if anyone can elaborate on that