Skip to content

FirebaseApp.configure(): Performing I/O on the main thread can cause hangs. #14619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nosferatu500 opened this issue Mar 27, 2025 · 5 comments

Comments

@nosferatu500
Copy link

Description

Hello!

I got this warning from Xcode today

FirebaseApp.configure(): Performing I/O on the main thread can cause hangs.

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
        
        FirebaseApp.configure()
        
        Messaging.messaging().delegate = self

Reproducing the issue

No response

Firebase SDK Version

11.10.0

Xcode Version

16.2

Installation Method

Swift Package Manager

Firebase Product(s)

Analytics

Targeted Platforms

iOS

Relevant Log Output

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
Replace this line with the contents of your Podfile.lock!
@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@nosferatu500
Copy link
Author

nosferatu500 commented Mar 27, 2025

Stack trace lead up to the next line

// GoogleUtilities/Environment/GULAppEnvironmentUtil

+ (BOOL)isAppExtension {
#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH
  // Documented by <a href="https://goo.gl/RRB2Up">Apple</a>
  BOOL appExtension = [[[NSBundle mainBundle] bundlePath] hasSuffix:@".appex"];     ← here
  return appExtension;
#elif TARGET_OS_OSX
  return NO;
#endif
}

@paulb777
Copy link
Member

Please share the stack trace

@nosferatu500
Copy link
Author

Hi! I haven't changed anything from the last report, and for now, I see no warnings in Xcode. I will update the issue if it appears again (probably an Xcode bug).

@goppinath
Copy link

Here are some more details. Xcode is displaying a warning in FIRApp.m at line 348, indicating that performing I/O operations on the main thread can lead to slow app launches, which may affect startup performance.

However, the Firebase documentation states that the default app configuration (_FIRAPP_DEFAULT) must be initialized on the main thread. This initialization process involves synchronous file I/O to read the GoogleService-Info.plist file from disk.

I am using Xcode version 16.4. Please refer to the screenshot for additional information.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants