FIRDatabase


@interface FIRDatabase : NSObject

The entry point for accessing a Firebase Database. You can get an instance by calling [FIRDatabase database]. To access a location in the database and read or write data, use [FIRDatabase reference].

  • The NSObject initializer that has been marked as unavailable. Use the database method instead

    Declaration

    Objective-C

    - (nonnull instancetype)init;

    Return Value

    An instancetype instance

  • Gets the instance of FIRDatabase for the default FIRApp.

    Declaration

    Objective-C

    + (nonnull FIRDatabase *)database;

    Return Value

    A FIRDatabase instance.

  • Gets a FirebaseDatabase instance for the specified URL.

    Declaration

    Objective-C

    + (nonnull FIRDatabase *)databaseWithURL:(nonnull NSString *)url;

    Parameters

    url

    The URL to the Firebase Database instance you want to access.

    Return Value

    A FIRDatabase instance.

  • Gets a FirebaseDatabase instance for the specified URL, using the specified FirebaseApp.

    Declaration

    Objective-C

    + (nonnull FIRDatabase *)databaseForApp:(nonnull FIRApp *)app
                                        URL:(nonnull NSString *)url;

    Parameters

    app

    The FIRApp to get a FIRDatabase for.

    url

    The URL to the Firebase Database instance you want to access.

    Return Value

    A FIRDatabase instance.

  • Gets an instance of FIRDatabase for a specific FIRApp.

    Declaration

    Objective-C

    + (nonnull FIRDatabase *)databaseForApp:(nonnull FIRApp *)app;

    Parameters

    app

    The FIRApp to get a FIRDatabase for.

    Return Value

    A FIRDatabase instance.

  • app

    The FIRApp instance to which this FIRDatabase belongs.

    Declaration

    Objective-C

    @property (readonly, nonatomic) FIRApp *_Nullable app;
  • Gets a FIRDatabaseReference for the root of your Firebase Database.

    Declaration

    Objective-C

    - (nonnull FIRDatabaseReference *)reference;
  • Gets a FIRDatabaseReference for the provided path.

    Declaration

    Objective-C

    - (nonnull FIRDatabaseReference *)referenceWithPath:(nonnull NSString *)path;

    Parameters

    path

    Path to a location in your Firebase Database.

    Return Value

    A FIRDatabaseReference pointing to the specified path.

  • Gets a FIRDatabaseReference for the provided URL. The URL must be a URL to a path within this Firebase Database. To create a FIRDatabaseReference to a different database, create a FIRApp} with a FIROptions object configured with the appropriate database URL.

    Declaration

    Objective-C

    - (nonnull FIRDatabaseReference *)referenceFromURL:
        (nonnull NSString *)databaseUrl;

    Parameters

    databaseUrl

    A URL to a path within your database.

    Return Value

    A FIRDatabaseReference for the provided URL.

  • The Firebase Database client automatically queues writes and sends them to the server at the earliest opportunity, depending on network connectivity. In some cases (e.g. offline usage) there may be a large number of writes waiting to be sent. Calling this method will purge all outstanding writes so they are abandoned.

    All writes will be purged, including transactions and onDisconnect writes. The writes will be rolled back locally, perhaps triggering events for affected event listeners, and the client will not (re-)send them to the Firebase Database backend.

    Declaration

    Objective-C

    - (void)purgeOutstandingWrites;
  • Shuts down our connection to the Firebase Database backend until goOnline is called.

    Declaration

    Objective-C

    - (void)goOffline;
  • Resumes our connection to the Firebase Database backend after a previous goOffline call.

    Declaration

    Objective-C

    - (void)goOnline;