Capacitor Firebase Authentication iOS RuntimeError (Keychain Sharing is already enabled)

I’m developing a Capacitor game and using the @capacitor-firebase/authentication plugin. It works perfectly on Android, but on iOS, the app hangs at the loading screen.

In the Xcode logs, I can see my web app’s JavaScript logs (console.log) executing correctly, including my log for “[BOOT] Firebase inicializado OK”.

However, immediately after the app loads, I get a fatal native error:

⚡️  Loading app at capacitor://localhost...
[ FirebaseAuthentication ]  <CapacitorFirebaseAuthentication.RuntimeError: 0x6000002742c0>
...
(My JS logs appear much later)
...
⚡️  [log] - [BOOT] Firebase inicializado OK
⚡️  WebView loaded

The app freezes because the native authentication plugin crashes, even though the web part of Firebase initializes.


What I Have Tried (Checklist)

I have followed every troubleshooting guide, and my configuration appears to be 100% correct:

  1. Keychain Sharing: The “Keychain Sharing” capability is enabled in “Signing & Capabilities” for my App target. *

  2. GoogleService-Info.plist:

    • The file is correctly placed in ios/App/App/.

    • The “Target Membership” is checked for the “App” target.

  3. Bundle ID Match:

    • My appId in capacitor.config.json

    • My Bundle Identifier in Xcode (“Signing & Capabilities”)

    • My BUNDLE_ID inside the GoogleService-Info.plist file

    • …all match exactly.

  4. Clean Build: I have performed a “nuclear clean” multiple times:

    • rm -rf ios/App/Pods

    • rm -rf ios/App/Podfile.lock

    • pod cache clean --all

    • pod install --repo-update

    • Xcode > Product > Clean Build Folder

    • Deleted the app from the simulator.

  5. Diagnostic Test: I added a check in AppDelegate.swift right after FirebaseApp.configure():

    Swift

    guard let _ = FirebaseApp.app() else {
        fatalError("--> FATAL ERROR: FirebaseApp.app() is null.")
    }
    
    

    The app does not crash with this error. This proves that FirebaseApp.configure() is succeeding, and the .plist file is being read correctly.

The Question

Given that FirebaseApp.configure() is successful, why is the FirebaseAuthentication plugin still throwing a RuntimeError immediately on launch?

It seems to be a Keychain Sharing problem, but my configuration looks correct. Is there a project cache, build setting, or provisioning profile issue that could cause Xcode to show the capability but not actually apply it in the build, leading to this RuntimeError?