FIRDatabaseQuery


@interface FIRDatabaseQuery : NSObject

A FIRDatabaseQuery instance represents a query over the data at a particular location.

You create one by calling one of the query methods (queryOrderedByChild:, queryStartingAtValue:, etc.) on a FIRDatabaseReference. The query methods can be chained to further specify the data you are interested in observing

  • observeEventType:withBlock: is used to listen for data changes at a particular location. This is the primary way to read data from the Firebase Database. Your block will be triggered for the initial data and again whenever the data changes.

    Use removeObserverWithHandle: to stop receiving updates.

    Declaration

    Objective-C

    - (FIRDatabaseHandle)
        observeEventType:(FIRDataEventType)eventType
               withBlock:(nonnull void (^)(FIRDataSnapshot *_Nonnull))block;

    Parameters

    eventType

    The type of event to listen for.

    block

    The block that should be called with initial data and updates. It is passed the data as a FIRDataSnapshot.

    Return Value

    A handle used to unregister this block later using removeObserverWithHandle:

  • observeEventType:andPreviousSiblingKeyWithBlock: is used to listen for data changes at a particular location. This is the primary way to read data from the Firebase Database. Your block will be triggered for the initial data and again whenever the data changes. In addition, for FIRDataEventTypeChildAdded, FIRDataEventTypeChildMoved, and FIRDataEventTypeChildChanged events, your block will be passed the key of the previous node by priority order.

    Use removeObserverWithHandle: to stop receiving updates.

    Declaration

    Objective-C

    - (FIRDatabaseHandle)observeEventType:(FIRDataEventType)eventType
           andPreviousSiblingKeyWithBlock:
               (nonnull void (^)(FIRDataSnapshot *_Nonnull,
                                 NSString *_Nullable))block;

    Parameters

    eventType

    The type of event to listen for.

    block

    The block that should be called with initial data and updates. It is passed the data as a FIRDataSnapshot and the previous child’s key.

    Return Value

    A handle used to unregister this block later using removeObserverWithHandle:

  • observeEventType:withBlock: is used to listen for data changes at a particular location. This is the primary way to read data from the Firebase Database. Your block will be triggered for the initial data and again whenever the data changes.

    The cancelBlock will be called if you will no longer receive new events due to no longer having permission.

    Use removeObserverWithHandle: to stop receiving updates.

    Declaration

    Objective-C

    - (FIRDatabaseHandle)
        observeEventType:(FIRDataEventType)eventType
               withBlock:(nonnull void (^)(FIRDataSnapshot *_Nonnull))block
         withCancelBlock:(nullable void (^)(NSError *_Nonnull))cancelBlock;

    Parameters

    eventType

    The type of event to listen for.

    block

    The block that should be called with initial data and updates. It is passed the data as a FIRDataSnapshot.

    cancelBlock

    The block that should be called if this client no longer has permission to receive these events

    Return Value

    A handle used to unregister this block later using removeObserverWithHandle:

  • observeEventType:andPreviousSiblingKeyWithBlock: is used to listen for data changes at a particular location. This is the primary way to read data from the Firebase Database. Your block will be triggered for the initial data and again whenever the data changes. In addition, for FIRDataEventTypeChildAdded, FIRDataEventTypeChildMoved, and FIRDataEventTypeChildChanged events, your block will be passed the key of the previous node by priority order.

    The cancelBlock will be called if you will no longer receive new events due to no longer having permission.

    Use removeObserverWithHandle: to stop receiving updates.

    Declaration

    Objective-C

    - (FIRDatabaseHandle)observeEventType:(