FirebaseCore Framework Reference

FirebaseApp

classFirebaseApp:NSObject

The entry point of Firebase SDKs.

Initialize and configureFirebaseApp usingFirebaseApp.configure() or other customized ways as shown below.

The logging system has two modes: default mode and debug mode. In default mode, only logs with log level Notice, Warning and Error will be sent to device. In debug mode, all logs will be sent to device. The log levels that Firebase uses are consistent with the ASL log levels.

Enable debug mode by passing the-FIRDebugEnabled argument to the application. You can add this argument in the application’s Xcode scheme. When debug mode is enabled via-FIRDebugEnabled, further executions of the application will also be in debug mode. In order to return to default mode, you must explicitly disable the debug mode with the application argument-FIRDebugDisabled.

It is also possible to change the default logging level in code by callingFirebaseConfiguration.shared.setLoggerLevel(_:) with the desired level.

  • Configures a default Firebase app. Raises an exception if any configuration step fails. Thedefault app is named “__FIRAPP_DEFAULT”. This method should be called after the app is launchedand before using Firebase services. This method should be called from the main thread andcontains synchronous file I/O (reading GoogleService-Info.plist from disk).

    Declaration

    Swift

    classfuncconfigure()
  • Configures the default Firebase app with the provided options. The default app is named “__FIRAPP_DEFAULT”. Raises an exception if any configuration step fails. This method should be called from the main thread.

    Declaration

    Swift

    classfuncconfigure(options:FIROptions)

    Parameters

    options

    The Firebase application options used to configure the service.

  • Configures a Firebase app with the given name and options. Raises an exception if any configuration step fails. This method should be called from the main thread.

    Declaration

    Swift

    classfuncconfigure(name:String,options:FIROptions)

    Parameters

    name

    The application’s name given by the developer. The name should should only contain Letters, Numbers and Underscore.

    options

    The Firebase application options used to configure the services.

  • Returns the default app, ornil if the default app does not exist.

    Declaration

    Swift

    classfuncapp()->FirebaseApp?
  • Returns a previously createdFirebaseApp instance with the given name, ornil if no such appexists. This method is thread safe.

    Declaration

    Swift

    classfuncapp(name:String)->FirebaseApp?
  • Returns the set of all extantFirebaseApp instances, ornil if there are noFirebaseAppinstances. This method is thread safe.

    Declaration

    Swift

    classvarallApps:[String:FirebaseApp]?{get}
  • Cleans up the currentFirebaseApp, freeing associated data and returning its name to the poolfor future use. This method is thread safe.

    Declaration

    Swift

    funcdelete()async->Bool
  • Unavailable

    FirebaseApp instances should not be initialized directly. CallFirebaseApp.configure(),FirebaseApp.configure(options:), orFirebaseApp.configure(name:options:) directly.

  • Gets the name of this app.

    Declaration

    Swift

    varname:String{get}
  • Gets a copy of the options for this app. These are non-modifiable.

    Declaration

    Swift

    @NSCopyingvaroptions:FIROptions{get}
  • Gets or sets whether automatic data collection is enabled for all products. Defaults totrueunlessFirebaseDataCollectionDefaultEnabled is set toNO in your app’s Info.plist. This valueis persisted across runs of the app so that it can be set once when users have consented tocollection.

    Declaration

    Swift

    varisDataCollectionDefaultEnabled:Bool{getset}

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-03-11 UTC.