Apptimize
@interface Apptimize : NSObjectThe Apptimize interface is the main interaction point with the Apptimize SDK for developers.
Getting Started
Add your Apptimize App Key to your application’s Info.plist e.g.
 ApptimizeAppKey = "AaaaABbbbBCcccCDdddDEeeeEFfffF" // Type: String; Without quotes.
For more information on how to get started using the Apptimize Library see: https://apptimize.com/docs/installation/ios-installation.html
- 
                  
                  Start Apptimize with the default options. Apptimize should be started on the main thread and can be safely started more than once. DeclarationObjective-C + (void)startApptimizeWithApplicationKey:(nonnull NSString *)applicationKey;Swift class func start(withApplicationKey applicationKey: String)ParametersapplicationKeyThe application key for this app as provided by the Apptimize dashboard. 
- 
                  
                  Start Apptimize with custom options. Apptimize should be started on the main thread and can be safely started more than once. DeclarationObjective-C + (void)startApptimizeWithApplicationKey:(nullable NSString *)applicationKey options: (nullable NSDictionary<NSString *, id> *) options;Swift class func start(withApplicationKey applicationKey: String?, options: [String : Any]? = nil)ParametersapplicationKeyThe application key for this app as provided by the Apptimize dashboard. optionsA dictionary containing some combination of ApptimizeDevicePairingOption,ApptimizeLogLevelOption,ApptimizeDelayUntilTestsAreAvailableOption,ApptimizeEnableThirdPartyEventImportingOption,ApptimizeEnableThirdPartyEventExportingOption,ApptimizeEnableInteractionEventCollectionOption,ApptimizeForceVariantsShowWinnersAndInstantUpdatesOption, and their respective values. May be nil.
- 
                  
                  Set the current customer-specified user ID. User IDs are arbitrary strings, except that they cannot be the empty string “”. When the customer-specified user ID is nil, then Apptimize creates and uses an anonymous user ID for tracking purposes. If the customerUserID is set to a non-nil value, then set back to nil, Apptimize will use the same anonymous user ID as before. The initial default value of the customer-specified user ID is nil. DeclarationObjective-C + (void)setCustomerUserID:(nullable NSString *)customerUserID;Swift class func setCustomerUserID(_ customerUserID: String?)ParameterscustomerUserIDAn NSString object containing the user ID to set. If this is nil, the user ID is set to be anonymous. 
- 
                  
                  Get the current customer-specified user ID. DeclarationObjective-C + (nullable NSString *)customerUserID;Swift class func customerUserID() -> String?Return ValueReturns an NSString object containing the currently set customer user ID. If the user is currently anonymous, nil will be returned. 
- 
                  
                  Get the current Apptimize-created anonymous user ID. This anonymous user ID will be used if-and-only-if the customer-specified user ID is nil. A single anonymous user ID is created. If the customer user ID is set to a non-nil value, then set back to nil, Apptimize will use the same anonymous user ID as before. DeclarationObjective-C + (nonnull NSString *)apptimizeAnonUserID;Swift class func apptimizeAnonUserID() -> StringReturn ValueReturns an NSString object containing the generated anonymous user ID. May not be nil. 
- 
                  
                  Disable Apptimize and all of its features for one application session. No tests will run, no data will be logged, and no results will be posted to the Apptimize dashboard. Use with caution. DeclarationObjective-C + (void)disable;Swift class func disable()
- 
                  
                  Set Apptimize to run in offline mode. In offline mode, all network traffic is disabled. Specifically, the app will not receive metadata, upload results, or (for debug builds) be able to pair with the Apptimize web dashboard. This setting is persistent and stays in effect across sessions. You may call setOffline before calling +startApptimizeWithApplicationKey:.DeclarationObjective-C + (void)setOffline:(BOOL)offlineFlag;Swift class func setOffline(_ offlineFlag: Bool)ParametersofflineFlagYES to enable offline mode, NO to disable offline mode. 
- 
                  
                  Get the current value of the offline setting DeclarationObjective-C + (BOOL)isOffline;Swift class func isOffline() -> BoolReturn ValueReturns YES if Apptimize is currently in offline mode, or NO if Apptimize is not currently set to offline mode. 
- 
                  
                  Set the log level of the Apptimize library. DeclarationObjective-C + (void)setLogLevel:(nonnull NSString *)logLevel;Swift class func setLogLevel(_ logLevel: String)ParameterslogLevel
- 
                  
                  Generate an event. DeclarationObjective-C + (void)track:(nonnull NSString *)eventName;Swift class func track(_ eventName: String)ParameterseventNameThe name of the event. 
- 
                  
                  Generate an event with an associated numeric value. DeclarationObjective-C + (void)track:(nonnull NSString *)eventName value:(double)value;Swift class func track(_ eventName: String, value: Double)ParameterseventNameThe name of the event. valueThe value associated with the event. 
- 
                  
                  DeclarationObjective-C + (nonnull NSString *)libraryVersion;Swift class func libraryVersion() -> StringReturn ValueReturns the version number of the Apptimize library as a string formatted as major.minor.build (e.g., 1.2.0). 
- 
                  
                  DeclarationObjective-C + (nonnull NSString *)userID;Swift class func userID() -> StringReturn ValueReturns the ID used by Apptimize to uniquely identify users of the current app. 
- 
                  
                  Sets the pilotTargetingID in order to use the pilot targeting feature available on the Apptimize web dashboard. Pilot targeting allows you to select specific pilot targeting IDs and groups of pilot targeting IDs in the Apptimize web dashboard for the purposes of targeting experiments and feature flags to specific app/user instances. Setting this value will cause pilot targeting to be recalculated if applicable. DeclarationObjective-C + (void)setPilotTargetingID:(nonnull NSString *)pilotTargetingID;Swift class func setPilotTargetingID(_ pilotTargetingID: String)ParameterspilotTargetingIDThe string ID to use for targeting pilot users. 
- 
                  
                  Retrieves the currently set pilot targeting ID. Pilot targeting allows you to select specific pilot targeting IDs and groups of pilot targeting IDs in the Apptimize web dashboard for the purposes of targeting experiments and feature flags to specific app/user instances. Setting this value will cause pilot targeting to be recalculated if applicable. DeclarationObjective-C + (nullable NSString *)pilotTargetingID;Swift class func pilotTargetingID() -> String?Return ValueReturns the pilot targeting ID. By default this value is nil. It should be set by your application to enable pilot targeting for the device. 
- 
                  
                  Run a code block A/B test. When this method is called, one of the code block variants or the default code block will be run sychronously in accordance with the A/B test variant this user/device is enrolled in. See Note: For Swift, use +[Apptimize runTest:withBaseline:apptimizeCodeBlocks:andOptions:]DeclarationObjective-C + (void)runTest:(nonnull NSString *)testName withBaseline:(nonnull void (^)(void))baselineBlock variations:(nonnull NSDictionary<NSString *, void (^)(void)> *)variations andOptions:(nullable NSDictionary<NSString *, NSNumber *> *)options;ParameterstestNameThe name of the test to run. baselineBlockThe default code block to execute if we are enrolled in the default variant. variationsA dictionary containing code blocks keyed using strings. The string keys must match the name of the variant set in the Apptimize dashboard. optionsNil or a dictionary containing ApptimizeUpdateMetadataTimeoutOptionand a value in milliseconds.
- 
                  
                  Run a code block A/B test. This is the same as calling +[Apptimize runTest:withBaseline:variations:andOptions:]with nil for options.When this method is called, one of the code block variants or the default code block will be run sychronously in accordance with the A/B test variant this user/device is enrolled in. See Note: For Swift, use +[Apptimize runTest:withBaseline:apptimizeCodeBlocks:andOptions:]DeclarationObjective-C + (void)runTest:(nonnull NSString *)testName withBaseline:(nonnull void (^)(void))baselineBlock andVariations: (nonnull NSDictionary<NSString *, void (^)(void)> *)variations;ParameterstestNameThe name of the test to run. baselineBlockThe default code block to execute if we are enrolled in the default variant. variationsA dictionary containing code blocks keyed using strings. The string keys correspond to the name of the variant set in the Apptimize dashboard. 
- 
                  
                  Run a code block A/B test. This is the same as +runTest:withBaseline:variations:andOptions:except that instead of taking a dictionary of Objective-C code blocks, it takes an array ofApptimizeCodeBlockobjects. This is useful for Swift where using+runTest:withBaseline:variations:andOptionsis problematic due to bridging issues.When this method is called, one of the code block variants or the default code block will be run sychronously in accordance with the A/B test variant this user/device is enrolled in. DeclarationObjective-C + (void)runTest:(nonnull NSString *)testName withBaseline:(nonnull void (^)(void))baselineBlock apptimizeCodeBlocks:(nonnull NSArray<ApptimizeCodeBlock *> *)codeBlocks andOptions: (nullable NSDictionary<NSString *, NSNumber *> *)options;Swift class func runTest(_ testName: String, withBaseline baselineBlock: @escaping () -> Void, apptimizeCodeBlocks codeBlocks: [ApptimizeCodeBlock], andOptions options: [String : NSNumber]? = nil)ParameterstestNameThe name of the test to run. baselineBlockThe default code block to execute if we are enrolled in the default variant. codeBlocksAn array containing ApptimizeCodeBlockobjects. The name of each object corresponds to the name of the variant set in the Apptimize dashboard.optionsNil or a dictionary containing ApptimizeUpdateMetadataTimeoutOptionand a value in milliseconds.
- 
                  
                  Run a code block A/B test. This is the same as calling +runTest:withBaseline:apptimizeCodeBlocks:andOptions:with nil for options.When this method is called, one of the code block variants or the default code block will be run sychronously in accordance with the A/B test variant this user/device is enrolled in. DeclarationObjective-C + (void)runTest:(nonnull NSString *)testName withBaseline:(nonnull void (^)(void))baselineBlock andApptimizeCodeBlocks:(nonnull NSArray<ApptimizeCodeBlock *> *)codeBlocks;Swift class func runTest(_ testName: String, withBaseline baselineBlock: @escaping () -> Void, andApptimizeCodeBlocks codeBlocks: [ApptimizeCodeBlock])ParameterstestNameThe name of the test to run. baselineBlockThe default code block to execute if we are enrolled in the default variant. codeBlocksAn array containing ApptimizeCodeBlockobjects. The name of each object corresponds to the name of the variant set in the Apptimize dashboard.
- 
                  
                  Check whether a given feature flag is enabled or not. DeclarationObjective-C + (BOOL)isFeatureFlagOn:(nonnull NSString *)featureFlagName;Swift class func isFeatureFlag(on featureFlagName: String) -> BoolReturn ValueReturns YES if the feature flag is on, NO if it is not. 
- 
                  
                  Get information about all Apptimize A/B tests and Feature Flags that the device is enrolled in. Note: this does not include information about Apptimize A/B tests or Feature Flags that are running but that the device is not enrolled in. DeclarationObjective-C + (nullable NSDictionary<NSString *, id<ApptimizeTestInfo>> *)testInfo;Swift class func testInfo() -> [String : ApptimizeTestInfo]?Return ValueReturns a dictionary whose keys are the names of all A/B tests and Feature Flags the device is enrolled in, and whose values are ApptimizeTestInfoobjects containing information about the test or Feature Flag. If this device is enrolled in no tests, an empty dictionary is returned. If+startApptimizeWithApplicationKey:has not been called yet, nil is returned.
- 
                  
                  Wait for the initial set of tests to become available. This method will block for timeoutmilliseconds (up to 8000) while Apptimize attempts to fetch tests and any related assets.This is meant to be used as part of application initialization, usually during a loading screen. DeclarationObjective-C + (BOOL)waitForTestsToBecomeAvailable:(NSTimeInterval)timeout;Swift class func waitForTests(toBecomeAvailable timeout: TimeInterval) -> BoolParameterstimeoutThe amount of time to wait before giving up and enrolling in the default variants. Capped at 8000 milliseconds. 
- 
                  
                  Set a user attribute string to be used for targeting, filtering and segmentation. DeclarationObjective-C + (void)setUserAttributeString:(nonnull NSString *)attributeValue forKey:(nonnull NSString *)attributeName;Swift class func setUserAttributeString(_ attributeValue: String, forKey attributeName: String)ParametersattributeValueThe attribute string to set for this app instance. attributeNameThe name of the attribute to set. 
- 
                  
                  Set a user attribute integer to be used in targeting, filtering and segmentation. DeclarationObjective-C + (void)setUserAttributeInteger:(NSInteger)attributeValue forKey:(nonnull NSString *)attributeName;Swift class func setUserAttributeInteger(_ attributeValue: Int, forKey attributeName: String)ParametersattributeValueThe attribute integer to set for this app instance. attributeNameThe name of the attribute to set. 
- 
                  
                  Set a user attribute double to be used in targeting, filtering and segmentation. DeclarationObjective-C + (void)setUserAttributeDouble:(double)attributeValue forKey:(nonnull NSString *)attributeName;Swift class func setUserAttributeDouble(_ attributeValue: Double, forKey attributeName: String)ParametersattributeValueThe attribute double to set for this app instance. attributeNameThe name of the attribute to set. 
- 
                  
                  Set a user attribute boolean to be used in targeting, filtering and segmentation. DeclarationObjective-C + (void)setUserAttributeBool:(BOOL)attributeValue forKey:(nonnull NSString *)attributeName;Swift class func setUserAttributeBool(_ attributeValue: Bool, forKey attributeName: String)ParametersattributeValueThe attribute boolean to set for this app instance. attributeNameThe name of the attribute to set. 
- 
                  
                  Remove the user defined attribute for a given for key. DeclarationObjective-C + (void)removeUserAttributeForKey:(nonnull NSString *)attributeName;Swift class func removeUserAttribute(forKey attributeName: String)ParametersattributeNameThe name of the attribute to remove. 
- 
                  
                  Remove all user defined attributes. DeclarationObjective-C + (void)removeAllUserAttributes;Swift class func removeAllUserAttributes()
- 
                  
                  Get the currently set string value for an attribute. DeclarationObjective-C + (nullable NSString *)userAttributeStringForKey: (nonnull NSString *)attributeName;Swift class func userAttributeString(forKey attributeName: String) -> String?ParametersattributeNameThe name of the attribute to query. Return ValueReturns the string value associated with the supplied attribute name. 
- 
                  
                  Get the currently set integer value for an attribute. DeclarationObjective-C + (NSInteger)userAttributeIntegerForKey:(nonnull NSString *)attributeName;Swift class func userAttributeInteger(forKey attributeName: String) -> IntParametersattributeNameThe name of the attribute to query. Return ValueReturns the integer value associated with the supplied attribute name. 
- 
                  
                  Get the currently set double value for an attribute. DeclarationObjective-C + (double)userAttributeDoubleForKey:(nonnull NSString *)attributeName;Swift class func userAttributeDouble(forKey attributeName: String) -> DoubleParametersattributeNameThe name of the attribute to query. Return ValueReturns the double value associated with the supplied attribute name. 
- 
                  
                  Get the currently set boolean value for an attribute. DeclarationObjective-C + (BOOL)userAttributeBoolForKey:(nonnull NSString *)attributeName;Swift class func userAttributeBool(forKey attributeName: String) -> BoolParametersattributeNameThe name of the attribute to query. Return ValueReturns the boolean value associated with the supplied attribute name. 
- 
                  
                  Set an attribute on a view to a value. Apptimize will use these attributes to gather more information about views for visual editing. DeclarationObjective-C + (void)setValue:(nonnull NSString *)value forAttribute:(nonnull NSString *)attributeName onView:(nonnull UIView *)view;Swift class func setValue(_ value: String, forAttribute attributeName: String, on view: UIView)ParametersvalueThe value to set for the attribute on the view. attributeNameThe name identifying the attribute to set on the view. viewThe view to set the attribute on. 
- 
                  
                  Force a variant with a given ID to be enabled. Once forceVariantis called, Apptimize is placed in a special test mode where it will only enable variants that are forced byforceVariant. All other Feature Flags, A/B Experiments and Instant Updates will appear disabled/off unless a specific variant is forced for those projects. CallforceVariantfor each of the variants you want to apply.See +[Apptimize clearAllForcedVariants]to return Apptimize to normal operation.All variants forced using this method will be treated as though they underwent experiment selection, and will be reflected on your results dashboard. Forced variants are persistent across application launches and will not be reset except by calls to +clearForcedVariant:variantID:or+clearAllForcedVariants:.Note that ApptimizeForceVariantsShowWinnersAndInstantUpdatesOptiondetermines whether winners and instant-updates will be shown. By default, this setting is off, so change your call to+startApptimizeWithApplicationKey:options:, or via Info.plist to turn it on as needed. TheAdvanced Verify feature on the dashboard will only work when winners and instant-updates are being shown, becauseAdvanced Verify works by sending an instant update to the paired device.DeclarationObjective-C + (void)forceVariant:(NSInteger)variantID;Swift class func forceVariant(_ variantID: Int)ParametersvariantIDThe numeric ID of the variant to forcibly enable. 
- 
                  
                  Cancel a forced variant. DeclarationObjective-C + (void)clearForcedVariant:(NSInteger)variantID;Swift class func clearForcedVariant(_ variantID: Int)ParametersvariantIDThe numeric ID of the variant to cancel force enabling for. 
- 
                  
                  Cancel all forced variants. DeclarationObjective-C + (void)clearAllForcedVariants;Swift class func clearAllForcedVariants()
- 
                  
                  Get a dictionary of information about all available variants. The returned dictionary is a mapping of variant IDs (in string format) to another dictionary with the following mappings: Key Value Type variantNameThe name of this variant String variantIDThe numeric ID of this variant Integer experimentNameThe name of the experiment associated with this variant String experimentIDThe numeric ID of the experiment associated with this variant Integer DeclarationObjective-C + (nullable NSDictionary<NSString *, NSDictionary<NSString *, id> *> *) getVariants;Swift class func getVariants() -> [String : [String : Any]]?Return ValueReturns a dictionary describing each available variant for this app in the format described above. The returned dictionary will be empty if there are no available variants. 
 Returns nil if+startApptimizeWithApplicationKey:has not been called.
 
         Apptimize Class Reference
        Apptimize Class Reference