Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[firebase_core] Firebase.initializeApp with demoProjectId crashes on iOS with SIGABRT (FIRInstallations validateAPIKey) - Follow-up to locked #17788

クローズ
#18,790 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@SelaseKay がすでに取り組んでいます。

2026年10月13日 から。

  • #18792 @SelaseKay による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
22/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
dart, ios
領域
mobile

調査の方向性

Start in firebase_core/lib/src/firebase.dart, where demoProjectId builds the FirebaseOptions with the hardcoded apiKey '12345'. Reproduce with the linked repro project on an iOS simulator to see the SIGABRT from FIRInstallations validateAPIKey. Pull request #18792 already targets this, so check it before starting. Done means the demo options pass validation on Apple platforms and the repro app launches without crashing.

索引モデルが issue の本文から書いたものです。

説明

Needs Attention platform: ios plugin: core reproduced type: bug type: crash
Description

This is a follow-up to locked issue #17788. I have created a clean, minimal reproduction project with no remote Firebase project, no GoogleService-Info.plist, and no google-services.json:
👉 Reproduction Repository: https://github.com/akurnaz/flutterfire_repro

The issue is that Firebase.initializeApp(demoProjectId: '...') crashes natively on iOS (EXC_CRASH (SIGABRT) / Abort trap: 6) as soon as any package that depends on FirebaseInstallations (e.g., firebase_crashlytics, firebase_auth, or firebase_messaging) is present.

Steps to Reproduce
  1. Clone the reproduction repo: git clone https://github.com/akurnaz/flutterfire_repro.git
  2. Run on an iOS Simulator: flutter run
  3. The application crashes immediately on startup.

Alternatively, in any fresh Flutter app:

  • Add firebase_core: ^4.15.0 and firebase_crashlytics: ^5.4.0 (which pulls in FirebaseInstallations).
  • Call await Firebase.initializeApp(demoProjectId: 'demo-template'); in main().
Crash Stack Trace
Termination: SIGNAL (Abort trap: 6 / SIGABRT)
CoreFoundation - __exceptionPreprocess
libobjc.A.dylib - objc_exception_throw
Runner - +[FIRInstallations validateAPIKey:]
Runner - +[FIRInstallations validateAppOptions:appName:]
Runner - -[FIRInstallations initWithAppOptions:appName:installationsIDController:prefetchAuthToken:]
Runner - -[FIRInstallations initWithApp:]
Runner - __40+[FIRInstallations componentsToRegister]_block_invoke
Runner - -[FIRComponentContainer instantiateInstanceForProtocol:withBlock:]
Runner - -[FIRComponentContainer instanceForProtocol:]
Runner - -[FIRComponentContainer instantiateEagerComponents]
Runner - +[FIRApp configureWithName:options:]
Runner - FLTFirebaseCorePlugin.initializeApp(appName:initializeAppRequest:completion:)
Root Cause
  1. In firebase_core/lib/src/firebase.dart, demoProjectId sets a hardcoded dummy API key:
resolvedOptions = FirebaseOptions(
  apiKey: '12345',
  appId: '1:1:$platformString:1',
  messagingSenderId: '',
  projectId: demoProjectId,
);
  1. In the iOS native SDK (firebase-ios-sdk), FIRInstallations.m strictly validates that the API key is 39 characters and begins with A:
+ (void)validateAPIKey:(nullable NSString *)APIKey {
  if (APIKey.length != kExpectedAPIKeyLength) { // kExpectedAPIKeyLength = 39
    [validationIssues addObject:@"API Key length must be 39 characters"];
  }

  if (![[APIKey substringToIndex:1] isEqualToString:@"A"]) {
    [validationIssues addObject:@"API Key must start with `A`"];
  }
  
  if (validationIssues.count > 0) {
    [NSException raise:kFirebaseInstallationsErrorDomain format:...];
  }
}
  1. Because '12345' fails this validation, an uncaught NSException is thrown, resulting in an uncatchable SIGABRT crash on iOS.
Suggested Fix

In firebase_core/lib/src/firebase.dart, format the dummy apiKey to be a 39-character string starting with A on Apple platforms:

apiKey: (defaultTargetPlatform == TargetPlatform.iOS || defaultTargetPlatform == TargetPlatform.macOS)
    ? 'AIzaSy0000000000000000000000000000000'
    : '12345',
主要言語
Dart
スター
9.3k
フォーク
4.1k
平均マージ
2日 8時間
マージ済み PR(30日)
46

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

firebase/flutterfire のほかの issue

firebase/flutterfire の issue をすべて見る

似ている issue

Dart の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。