I am attempting to use the firebase database in my watchKit app. I have developed this feature on my iPhone application but have found it difficult to do the same on my Watch app. When I attempted to import firebase into the VC class in watch app, it is creating an error no such module 'firebase'
.
Is it possible to use firebase inside a watch app?
Firebase library support by platform For the time being, watchOS is community-supported only. See the Firebase Apple platforms SDK GitHub repository for installation instructions and known issues. Note: Though Test Lab has no client SDK, it does support iOS.
Firebase Hosting is a CDN for hosting static websites. So it is not possible to host an application like MongoDB server. You can't host MongoDB on any Firebase services.
Firebase supports installation with CocoaPods in addition to Swift Package Manager. To your Podfile, add the Firebase pods that you want to use in your app.
Overview. Firebase provides the tools and infrastructure you need to develop, grow, and earn money from your app. This package supports web (browser), mobile-web, and server (Node. js) clients.
Sadly there is no Firebase
support for watchOS2
and watchOS3
due to the fact that there's no support for CFNetwork
in these versions of watchOS
and Firebase
is highly dependent on this framework. Source (thanks for the link @FrankvanPuffelen in comments).
You have two alternatives:
Firebase REST API
directly from your watch app.Firebase
communication from the iPhone
app and use the WatchConnectivity
framework to send the relevant changes to your watch app.Depending on your exact use case, you could choose any of the two. The main advantages/disadvantages of these two are that the WatchConnectivity
framework is quite limited as in when it can be used. Both of your apps needs to be running at least in the background for the WatchConenctivity
framework to work. On the other hand, if you choose to use the REST API
, you don't need the watch app to communicate with the iPhone
counterpart, the watch app can directly get the Firebase
data using network requests. However, in this scenario, the network usage will be bigger, since you will need to essentially fetch the same information both for the iPhone
and watch apps.
Update for watchOS 6: Firebase Messaging has been released with watchOS support, however, the Realtime Database along with other Firebase SDKs are still not supported. You can track the progress of them in this GitHub issue, which also contains links to the specific feature request issues for the other SDKs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With