firebase-ios-sdk: [Firebase Database] Database calls do not work on watchOS 9

Description

The FirebaseDatabase SDK does not work on watchOS 9. I have been having issues with websockets in my own products, and I believe this issue might be related to that. I am using FirebaseAuth just fine, and can make rest calls to the database with Alamofire.

Reproducing the issue

Try to read/write from the database on watchOS 9

Firebase SDK Version

9.5.0

Xcode Version

13.4.1

Installation Method

CocoaPods

Firebase Product(s)

Database

Targeted Platforms

watchOS

Relevant Log Output

Don't have physical access to a watchOS 9 device at the moment, and the issue doesn't show up on emulators.

If using Swift Package Manager, the project’s Package.resolved

Expand Package.resolved snippet

Replace this line with the contents of your Package.resolved.

If using CocoaPods, the project’s Podfile.lock

Expand Podfile.lock snippet

PODS:
  - Alamofire (5.6.2)
  - FirebaseAppCheck (9.5.0):
    - FirebaseCore (~> 9.0)
    - GoogleUtilities/Environment (~> 7.7)
    - PromisesObjC (~> 2.1)
  - FirebaseAuth (9.5.0):
    - FirebaseCore (~> 9.0)
    - GoogleUtilities/AppDelegateSwizzler (~> 7.7)
    - GoogleUtilities/Environment (~> 7.7)
    - GTMSessionFetcher/Core (< 3.0, >= 1.7)
  - FirebaseCore (9.5.0):
    - FirebaseCoreDiagnostics (~> 9.0)
    - FirebaseCoreInternal (~> 9.0)
    - GoogleUtilities/Environment (~> 7.7)
    - GoogleUtilities/Logger (~> 7.7)
  - FirebaseCoreDiagnostics (9.5.0):
    - GoogleDataTransport (< 10.0.0, >= 9.1.4)
    - GoogleUtilities/Environment (~> 7.7)
    - GoogleUtilities/Logger (~> 7.7)
    - nanopb (< 2.30910.0, >= 2.30908.0)
  - FirebaseCoreInternal (9.5.0):
    - "GoogleUtilities/NSData+zlib (~> 7.7)"
  - FirebaseCrashlytics (9.5.0):
    - FirebaseCore (~> 9.0)
    - FirebaseInstallations (~> 9.0)
    - GoogleDataTransport (< 10.0.0, >= 9.1.4)
    - GoogleUtilities/Environment (~> 7.7)
    - nanopb (< 2.30910.0, >= 2.30908.0)
    - PromisesObjC (~> 2.1)
  - FirebaseInstallations (9.5.0):
    - FirebaseCore (~> 9.0)
    - GoogleUtilities/Environment (~> 7.7)
    - GoogleUtilities/UserDefaults (~> 7.7)
    - PromisesObjC (~> 2.1)
  - GoogleDataTransport (9.2.0):
    - GoogleUtilities/Environment (~> 7.7)
    - nanopb (< 2.30910.0, >= 2.30908.0)
    - PromisesObjC (< 3.0, >= 1.2)
  - GoogleUtilities/AppDelegateSwizzler (7.7.0):
    - GoogleUtilities/Environment
    - GoogleUtilities/Logger
    - GoogleUtilities/Network
  - GoogleUtilities/Environment (7.7.0):
    - PromisesObjC (< 3.0, >= 1.2)
  - GoogleUtilities/Logger (7.7.0):
    - GoogleUtilities/Environment
  - GoogleUtilities/Network (7.7.0):
    - GoogleUtilities/Logger
    - "GoogleUtilities/NSData+zlib"
    - GoogleUtilities/Reachability
  - "GoogleUtilities/NSData+zlib (7.7.0)"
  - GoogleUtilities/Reachability (7.7.0):
    - GoogleUtilities/Logger
  - GoogleUtilities/UserDefaults (7.7.0):
    - GoogleUtilities/Logger
  - GTMSessionFetcher/Core (2.1.0)
  - nanopb (2.30909.0):
    - nanopb/decode (= 2.30909.0)
    - nanopb/encode (= 2.30909.0)
  - nanopb/decode (2.30909.0)
  - nanopb/encode (2.30909.0)
  - NWWebSocket (0.5.2)
  - PromisesObjC (2.1.1)
  - SwiftyStoreKit (0.16.1)

DEPENDENCIES:
  - Alamofire
  - FirebaseAppCheck
  - FirebaseAuth
  - FirebaseCore
  - FirebaseCrashlytics
  - NWWebSocket
  - SwiftyStoreKit

SPEC REPOS:
  trunk:
    - Alamofire
    - FirebaseAppCheck
    - FirebaseAuth
    - FirebaseCore
    - FirebaseCoreDiagnostics
    - FirebaseCoreInternal
    - FirebaseCrashlytics
    - FirebaseInstallations
    - GoogleDataTransport
    - GoogleUtilities
    - GTMSessionFetcher
    - nanopb
    - NWWebSocket
    - PromisesObjC
    - SwiftyStoreKit

SPEC CHECKSUMS:
  Alamofire: d368e1ff8a298e6dde360e35a3e68e6c610e7204
  FirebaseAppCheck: 84e58ced2b43249bb75529da1c33193b71e9c3c6
  FirebaseAuth: 741918f1fa62ed23246a509279f91d42d79a713f
  FirebaseCore: 25c0400b670fd1e2f2104349cd3b5dcce8d9418f
  FirebaseCoreDiagnostics: 17cbf4e72b1dbd64bfdc33d4b1f07bce4f16f1d8
  FirebaseCoreInternal: 50a8e39cae8abf72d5145d07ea34c3244f70862b
  FirebaseCrashlytics: d20fa38bb8c88cb0f1c9211286bc23ab58c1b464
  FirebaseInstallations: 41f811b530c41dd90973d0174381cdb3fcb5e839
  GoogleDataTransport: 1c8145da7117bd68bbbed00cf304edb6a24de00f
  GoogleUtilities: e0913149f6b0625b553d70dae12b49fc62914fd1
  GTMSessionFetcher: ffbb25ec00ebcb5201adab0a56d808f6f1902d9f
  nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431
  NWWebSocket: 21f0c73639815da3272862c912275b26102aa80c
  PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb
  SwiftyStoreKit: 6b9c08810269f030586dac1fae8e75871a82e84a

PODFILE CHECKSUM: bc259dea40d518c905f5b56c82dbfb8316383e71

COCOAPODS: 1.11.3


About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 52 (16 by maintainers)

Most upvoted comments

Uhhh… WHAT???

IMG_1178

I think I figured it out. Just add a header to the request like this:

"X-Firebase-AppCheck": appCheckToken

It’s stupid easy to use the RTD REST API. I’m not even sure it’s worth the effort to update the client SDK.

It doesn’t look very good:

https://developer.apple.com/forums/thread/715024

Basically it is stated that web sockets aren’t supposed to be supported on watchOS. It just wasn’t enforced correctly previously. 😢

https://blog.back4app.com/firebase-alternatives/

Thanks for sharing. To be noted, none of these technologies will allow web sockets on watchOS 9. 😉

You don’t need web sockets to support updating a database via a watchOS app…

https://blog.back4app.com/firebase-alternatives/

Thanks for sharing. To be noted, none of these technologies will allow web sockets on watchOS 9. 😉

Hey all. Based on Apple’s comments, RTDB is likely to remain broken for the forseeable future on watchOS. In the short term, we’ll mark these APIs as deprecated, but they should continue to work if you’re using RTDB in the context of an audio streaming app. In the longer term, we’ll look at replacing the single event methods with REST calls under the hood so they remain usable on watchOS, but I don’t have a timeline for that work since watchOS is a lower priority than the other platforms.

Someone posted this to the developer forums: https://developer.apple.com/forums/thread/714796 (thanks if it was someone from this thread!)

Guys, support the thread…

Posted, wanted to post a repro case for Apple folks to look at. That’s here: https://gist.github.com/ryanwilson/fd5454a681eab32348ebc7119949182c

Someone posted this to the developer forums: https://developer.apple.com/forums/thread/714796

(thanks if it was someone from this thread!)

Guys, support the thread…

I just tested a plain websocket connection (not including RTDB) on my watchOS 9 device and it fails with the same error code. It does works in the simulator.

I’ve only been testing on watchOS 8 since I don’t have a watchOS 9 device so yeah