Stay organized with collections
Save and categorize content based on your preferences.
Installations
classInstallations:NSObject
The class provides API for Firebase Installations.
Each configured FirebaseApp has a corresponding single instance of Installations.
An instance of the class provides access to the installation info for the FirebaseApp as well
as the ability to delete it. A Firebase Installation is unique by FirebaseApp.name and
FirebaseApp.options.googleAppID .
An instance of Installations for FirebaseApp.defaultApp().
@throw Throws an exception if the default app is not configured yet or requiredFirebaseApp`
options are missing.
The method creates or retrieves an installation ID. The installation ID is a stable identifier
that uniquely identifies the app instance. NOTE: If the application already has an existing
FirebaseInstanceID then the InstanceID identifier will be used.
Declaration
Swift
funcinstallationID()asyncthrows->String
Parameters
completion
A completion handler which is invoked when the operation completes.
Retrieves (locally if it exists or from the server) a valid installation auth token. An existing
token may be invalidated or expired, so it is recommended to fetch the installation auth token
before each server request. The method does the same as
Installations.authToken(forcingRefresh:completion:) with forcing refresh false.
Retrieves (locally or from the server depending on forceRefresh value) a valid installation
auth token. An existing token may be invalidated or expire, so it is recommended to fetch the
installation auth token before each server request. This method should be used with forceRefresh
== true when e.g. a request with the previously fetched installation auth token failed with “Not
Authorized” error.
If true then the locally cached installation auth token will be ignored and
a new one will be requested from the server. If false, then the locally cached installation
auth token will be returned if exists and has not expired yet.
completion
A completion handler which is invoked when the operation completes. See
InstallationsTokenHandler for additional details.
Deletes all the installation data including the unique identifier, auth tokens and
all related data on the server side. A network connection is required for the method to
succeed. If fails, the existing installation data remains untouched.
Declaration
Swift
funcdelete()asyncthrows
Parameters
completion
A completion handler which is invoked when the operation completes. error ==
nil indicates success.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-11 UTC."],[],[],null,["# FirebaseInstallations Framework Reference\n\nInstallations\n=============\n\n class Installations : NSObject\n\nThe class provides API for Firebase Installations.\nEach configured `FirebaseApp` has a corresponding single instance of `Installations`.\nAn instance of the class provides access to the installation info for the `FirebaseApp` as well\nas the ability to delete it. A Firebase Installation is unique by `FirebaseApp.name` and\n`FirebaseApp.options.googleAppID` .\n- `\n ``\n ``\n `\n\n ### [-init](#/c:objc(cs)FIRInstallations(im)init)\n\n `\n ` \n Unavailable \n Undocumented\n- `\n ``\n ``\n `\n\n ### [installations()](#/c:objc(cs)FIRInstallations(cm)installations)\n\n `\n ` \n Returns a default instance of `Installations`. \n\n #### Declaration\n\n Swift \n\n class func installations() -\u003e Installations\n\n #### Return Value\n\n An instance of `Installations` for `FirebaseApp.defaultApp().\n @throw Throws an exception if the default app is not configured yet or required`FirebaseApp\\`\n options are missing.\n- `\n ``\n ``\n `\n\n ### [installations(app:)](#/c:objc(cs)FIRInstallations(cm)installationsWithApp:)\n\n `\n ` \n Returns an instance of `Installations` for an application. \n\n #### Declaration\n\n Swift \n\n class func installations(app application: FIRApp) -\u003e Installations\n\n #### Parameters\n\n |---------------------|--------------------------------------|\n | ` `*application*` ` | A configured `FirebaseApp` instance. |\n\n #### Return Value\n\n An instance of `Installations` corresponding to the passed application.\n @throw Throws an exception if required `FirebaseApp` options are missing.\n- `\n ``\n ``\n `\n\n ### [installationID()](#/c:objc(cs)FIRInstallations(im)installationIDWithCompletion:)\n\n `\n ` \n The method creates or retrieves an installation ID. The installation ID is a stable identifier\n that uniquely identifies the app instance. NOTE: If the application already has an existing\n FirebaseInstanceID then the InstanceID identifier will be used. \n\n #### Declaration\n\n Swift \n\n func installationID() async throws -\u003e String\n\n #### Parameters\n\n |--------------------|---------------------------------------------------------------------|\n | ` `*completion*` ` | A completion handler which is invoked when the operation completes. |\n\n- `\n ``\n ``\n `\n\n ### [authToken()](#/c:objc(cs)FIRInstallations(im)authTokenWithCompletion:)\n\n `\n ` \n Retrieves (locally if it exists or from the server) a valid installation auth token. An existing\n token may be invalidated or expired, so it is recommended to fetch the installation auth token\n before each server request. The method does the same as\n `Installations.authToken(forcingRefresh:completion:)` with forcing refresh `false`. \n\n #### Declaration\n\n Swift \n\n func authToken() async throws -\u003e FIRInstallationsAuthTokenResult\n\n #### Parameters\n\n |--------------------|---------------------------------------------------------------------|\n | ` `*completion*` ` | A completion handler which is invoked when the operation completes. |\n\n- `\n ``\n ``\n `\n\n ### [authTokenForcingRefresh(_:)](#/c:objc(cs)FIRInstallations(im)authTokenForcingRefresh:completion:)\n\n `\n ` \n Retrieves (locally or from the server depending on `forceRefresh` value) a valid installation\n auth token. An existing token may be invalidated or expire, so it is recommended to fetch the\n installation auth token before each server request. This method should be used with `forceRefresh\n == true` when e.g. a request with the previously fetched installation auth token failed with \"Not\n Authorized\" error. \n\n #### Declaration\n\n Swift \n\n func authTokenForcingRefresh(_ forceRefresh: Bool) async throws -\u003e FIRInstallationsAuthTokenResult\n\n #### Parameters\n\n |----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n | ` `*forceRefresh*` ` | If `true` then the locally cached installation auth token will be ignored and a new one will be requested from the server. If `false`, then the locally cached installation auth token will be returned if exists and has not expired yet. |\n | ` `*completion*` ` | A completion handler which is invoked when the operation completes. See `InstallationsTokenHandler` for additional details. |\n\n- `\n ``\n ``\n `\n\n ### [delete()](#/c:objc(cs)FIRInstallations(im)deleteWithCompletion:)\n\n `\n ` \n Deletes all the installation data including the unique identifier, auth tokens and\n all related data on the server side. A network connection is required for the method to\n succeed. If fails, the existing installation data remains untouched. \n\n #### Declaration\n\n Swift \n\n func delete() async throws\n\n #### Parameters\n\n |--------------------|-------------------------------------------------------------------------------------------------------|\n | ` `*completion*` ` | A completion handler which is invoked when the operation completes. `error == nil` indicates success. |"]]