FIRExperimentController
@interface FIRExperimentController : NSObjectThis class is for Firebase services to handle experiments updates to Firebase Analytics. Experiments can be set, cleared and updated through this controller.
-
Returns the FIRExperimentController singleton.
Declaration
Objective-C
+ (nonnull FIRExperimentController *)sharedInstance; -
Updates the list of experiments with an optional completion handler. Experiments already existing in payloads are not affected, whose state and payload is preserved. This method compares whether the experiments have changed or not by their variant ID. This runs in a background queue and calls the completion handler when finished executing.
Declaration
Objective-C
- (void) updateExperimentsWithServiceOrigin:(nonnull NSString *)origin events:(nonnull FIRLifecycleEvents *)events policy: (ABTExperimentPayloadExperimentOverflowPolicy) policy lastStartTime:(NSTimeInterval)lastStartTime payloads:(nonnull NSArray<NSData *> *)payloads completionHandler:(nullable void (^)(NSError *_Nullable)) completionHandler;Parameters
originThe originating service affected by the experiment.
eventsA list of event names to be used for logging experiment lifecycle events, if they are not defined in the payload.
policyThe policy to handle new experiments when slots are full.
lastStartTimeThe last known experiment start timestamp for this affected service. (Timestamps are specified by the number of seconds from 00:00:00 UTC on 1 January 1970.).
payloadsList of experiment metadata.
completionHandlerCode to be executed after experiments are updated in the background thread.
-
Returns the latest experiment start timestamp given a current latest timestamp and a list of experiment payloads. Timestamps are specified by the number of seconds from 00:00:00 UTC on 1 January 1970.
Declaration
Objective-C
- (NSTimeInterval) latestExperimentStartTimestampBetweenTimestamp:(NSTimeInterval)timestamp andPayloads:(nonnull NSArray<NSData *> *) payloads;Parameters
timestampCurrent latest experiment start timestamp. If not known, affected service should specify -1;
payloadsList of experiment metadata.
-
Expires experiments that aren’t in the list of running experiment payloads.
Declaration
Objective-C
- (void)validateRunningExperimentsForServiceOrigin:(nonnull NSString *)origin runningExperimentPayloads: (nonnull NSArray<ABTExperimentPayload *> *) payloads;Parameters
originThe originating service affected by the experiment.
payloadsThe list of valid, running experiments.
-
Directly sets a given experiment to be active.
Declaration
Objective-C
- (void)activateExperiment:(nonnull ABTExperimentPayload *)experimentPayload forServiceOrigin:(nonnull NSString *)origin;Parameters
experimentPayloadThe payload for the experiment that should be activated.
originThe originating service affected by the experiment.