NativeScript / NativeScript/firebase

initializeApp not working on iOS device

Open
#166 25 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
62
Forks
53
Avg merge
8d 4h
Merged PRs (30d)
2

Description

I'm converting an app from the old @nativescript/firebase library, and this is just about complete and fully functional on Android. I just tried running this on iOS, and the app is not initializing properly. In looking through firebase-core/index.ios.js, I've discovered that my initialization request is being added to the launchQueue array, but launchCallback is never being called.

There are no errors shown in the logs, so from what I can see the issue is just that this launchQueue is never being used.

I have the same GoogleService-Info.plist file as before in App_Resources/iOS. These are the relevant parts of the main.js file that's acting as the entry point:

import { firebase } from '@nativescript/firebase-core'
import '@nativescript/firebase-auth';
import '@nativescript/firebase-crashlytics';
import '@nativescript/firebase-analytics';
import '@nativescript/firebase-messaging';

// Initialize Firebase
firebase().initializeApp().then(() => {
  console.warn('🔥 Firebase initialized');
}).catch(error => {
  console.error('🔥 Firebase initialization error: ', error)
});

If I log to the console right before firebase().initializeApp() on iOS I see the log, but the 'Firebase initialized' log never appears. Adding additional logs in firebase-core/index.ios.js shows me that UIApplication.sharedApplication is null when checked, so the call to initApp is appended to the launchQueue array and then never used.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with firebase-core/index.ios.js and the initializeApp call in main.js. Trace how UIApplication.sharedApplication, launchQueue, and launchCallback are handled during iOS startup. Done means initialization resolves on an iOS device and the existing success or error callbacks are reached; verify with the reported logging scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
firebase, ios, typescript
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.