2 * Copyright 2017 Google
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #import <Foundation/Foundation.h>
21 NS_ASSUME_NONNULL_BEGIN
23 /** A block that takes a BOOL and has no return value. */
24 typedef void (^FIRAppVoidBoolCallback)(BOOL success) NS_SWIFT_NAME(FirebaseAppVoidBoolCallback);
27 * The entry point of Firebase SDKs.
29 * Initialize and configure FIRApp using +[FIRApp configure]
30 * or other customized ways as shown below.
32 * The logging system has two modes: default mode and debug mode. In default mode, only logs with
33 * log level Notice, Warning and Error will be sent to device. In debug mode, all logs will be sent
34 * to device. The log levels that Firebase uses are consistent with the ASL log levels.
36 * Enable debug mode by passing the -FIRDebugEnabled argument to the application. You can add this
37 * argument in the application's Xcode scheme. When debug mode is enabled via -FIRDebugEnabled,
38 * further executions of the application will also be in debug mode. In order to return to default
39 * mode, you must explicitly disable the debug mode with the application argument -FIRDebugDisabled.
41 * It is also possible to change the default logging level in code by calling setLoggerLevel: on
42 * the FIRConfiguration interface.
44 NS_SWIFT_NAME(FirebaseApp)
45 @interface FIRApp : NSObject
48 * Configures a default Firebase app. Raises an exception if any configuration step fails. The
49 * default app is named "__FIRAPP_DEFAULT". This method should be called after the app is launched
50 * and before using Firebase services. This method is thread safe and contains synchronous file I/O
51 * (reading GoogleService-Info.plist from disk).
56 * Configures the default Firebase app with the provided options. The default app is named
57 * "__FIRAPP_DEFAULT". Raises an exception if any configuration step fails. This method is thread
60 * @param options The Firebase application options used to configure the service.
62 + (void)configureWithOptions:(FIROptions *)options NS_SWIFT_NAME(configure(options:));
65 * Configures a Firebase app with the given name and options. Raises an exception if any
66 * configuration step fails. This method is thread safe.
68 * @param name The application's name given by the developer. The name should should only contain
69 Letters, Numbers and Underscore.
70 * @param options The Firebase application options used to configure the services.
73 + (void)configureWithName:(NSString *)name
74 options:(FIROptions *)options NS_SWIFT_NAME(configure(name:options:));
78 * Returns the default app, or nil if the default app does not exist.
80 + (nullable FIRApp *)defaultApp NS_SWIFT_NAME(app());
83 * Returns a previously created FIRApp instance with the given name, or nil if no such app exists.
84 * This method is thread safe.
86 + (nullable FIRApp *)appNamed:(NSString *)name NS_SWIFT_NAME(app(name:));
89 * Returns the set of all extant FIRApp instances, or nil if there are no FIRApp instances. This
90 * method is thread safe.
92 @property(class, readonly, nullable) NSDictionary<NSString *, FIRApp *> *allApps;
95 * Cleans up the current FIRApp, freeing associated data and returning its name to the pool for
96 * future use. This method is thread safe.
98 - (void)deleteApp:(FIRAppVoidBoolCallback)completion;
101 * FIRApp instances should not be initialized directly. Call +[FIRApp configure],
102 * +[FIRApp configureWithOptions:], or +[FIRApp configureWithNames:options:] directly.
104 - (instancetype)init NS_UNAVAILABLE;
107 * Gets the name of this app.
109 @property(nonatomic, copy, readonly) NSString *name;
112 * Gets a copy of the options for this app. These are non-modifiable.
114 @property(nonatomic, copy, readonly) FIROptions *options;
117 * Gets or sets whether automatic data collection is enabled for all products. Defaults to `YES`
118 * unless `FirebaseDataCollectionDefaultEnabled` is set to `NO` in your app's Info.plist. This value
119 * is persisted across runs of the app so that it can be set once when users have consented to
122 @property(nonatomic, readwrite, getter=isDataCollectionDefaultEnabled)
123 BOOL dataCollectionDefaultEnabled;
127 NS_ASSUME_NONNULL_END