FIRApp
@interface FIRApp : NSObjectThe entry point of Firebase SDKs.
Initialize and configure FirebaseApp using FirebaseApp.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 calling
FirebaseConfiguration.shared.setLoggerLevel(_:) with the desired level.
-
Configures a default Firebase app. Raises an exception if any configuration step fails. The default app is named “__FIRAPP_DEFAULT”. This method should be called after the app is launched and before using Firebase services. This method should be called from the main thread and contains synchronous file I/O (reading GoogleService-Info.plist from disk).
Declaration
Objective-C
+ (void)configure; -
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
Objective-C
+ (void)configureWithOptions:(nonnull FIROptions *)options;Parameters
optionsThe 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
Objective-C
+ (void)configureWithName:(nonnull NSString *)name options:(nonnull FIROptions *)options;Parameters
nameThe application’s name given by the developer. The name should should only contain Letters, Numbers and Underscore.
optionsThe Firebase application options used to configure the services.
-
Returns the default app, or
nilif the default app does not exist.Declaration
Objective-C
+ (nullable FIRApp *)defaultApp; -
Returns a previously created
FirebaseAppinstance with the given name, ornilif no such app exists. This method is thread safe.Declaration
Objective-C
+ (nullable FIRApp *)appNamed:(nonnull NSString *)name; -
Returns the set of all extant
FirebaseAppinstances, ornilif there are noFirebaseAppinstances. This method is thread safe.Declaration
Objective-C
@property (class, readonly, nullable) NSDictionary<NSString *, FIRApp *> *allApps; -
Cleans up the current
FirebaseApp, freeing associated data and returning its name to the pool for future use. This method is thread safe.Declaration
Objective-C
- (void)deleteApp:(nonnull void (^)(BOOL))completion; -
Unavailable
FirebaseAppinstances should not be initialized directly. CallFirebaseApp.configure(),FirebaseApp.configure(options:), orFirebaseApp.configure(name:options:)directly.Declaration
Objective-C
- (nonnull instancetype)init; -
Gets the name of this app.
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSString *_Nonnull name; -
Gets a copy of the options for this app. These are non-modifiable.
Declaration
Objective-C
@property (nonatomic, copy, readonly) FIROptions *_Nonnull options; -
Gets or sets whether automatic data collection is enabled for all products. Defaults to
trueunlessFirebaseDataCollectionDefaultEnabledis set toNOin your app’s Info.plist. This value is persisted across runs of the app so that it can be set once when users have consented to collection.Declaration
Objective-C
@property (nonatomic, assign, unsafe_unretained, readwrite, getter=isDataCollectionDefaultEnabled) BOOL dataCollectionDefaultEnabled;