|
1 | 1 | # Optimizely Objective-C SDK Changelog
|
| 2 | + |
| 3 | +## 2.1.0 |
| 4 | +August 2nd, 2018 |
| 5 | + |
| 6 | +This release is the 2.x general availability launch of the Objective-C SDK, which includes a number of significant new features that are now stable and fully supported. [Feature Management](https://developers.optimizely.com/x/solutions/sdks/reference/?language=objectivec#feature-introduction) is now generally available, which introduces new APIs and which replaces the SDK's variable APIs (`getVariableBoolean`, etc.) with the feature variable APIs (`getFeatureVariableBoolean`, etc.). |
| 7 | + |
| 8 | +The primary difference between the new Feature Variable APIs and the older, Variable APIs is that they allow you to link your variables to a Feature (a new type of entity defined in the Optimizely UI) and to a feature flag in your application. This in turn allows you to run Feature Tests and Rollouts on both your Features and Feature Variables. For complete details of the Feature Management APIs, see the "New Features" section below. |
| 9 | + |
| 10 | +To learn more about Feature Management, read our [knowledge base article introducing the feature](https://help.optimizely.com/Set_Up_Optimizely/Develop_a_product_or_feature_with_Feature_Management). |
| 11 | + |
| 12 | +### New Features |
| 13 | +* Introduces the `isFeatureEnabled` API, a featue flag used to determine whether to show a feature to a user. The `isFeatureEnabled` should be used in place of the `activate` API to activate experiments running on features. Specifically, calling this API causes the SDK to evaluate all [Feature Tests](https://developers.optimizely.com/x/solutions/sdks/reference/?language=objectivec#activate-feature-tests) and [Rollouts](https://developers.optimizely.com/x/solutions/sdks/reference/?language=objectivec#activate-feature-rollouts) associated with the provided feature key. |
| 14 | +``` |
| 15 | +/** |
| 16 | + * Determine whether a feature is enabled. |
| 17 | + * Send an impression event if the user is bucketed into an experiment using the feature. |
| 18 | + * @param featureKey The key for the feature flag. |
| 19 | + * @param userId The user ID to be used for bucketing. |
| 20 | + * @param attributes The user's attributes. |
| 21 | + * @return YES if feature is enabled, false otherwise. |
| 22 | + */ |
| 23 | +- (BOOL)isFeatureEnabled:(nullable NSString *)featureKey userId:(nullable NSString *)userId attributes:(nullable NSDictionary<NSString *, NSString *> *)attributes; |
| 24 | +``` |
| 25 | + |
| 26 | + |
| 27 | +* Get all enabled features for a user by calling the following method, which returns a list of strings representing the feature keys: |
| 28 | +``` |
| 29 | +/** |
| 30 | + * Get array of features that are enabled for the user. |
| 31 | + * @param userId The user ID to be used for bucketing. |
| 32 | + * @param attributes The user's attributes. |
| 33 | + * @return NSArray<NSString> Array of feature keys that are enabled for the user. |
| 34 | + */ |
| 35 | +- (NSArray<NSString *> *_Nonnull)getEnabledFeatures:(nullable NSString *)userId |
| 36 | + attributes:(nullable NSDictionary<NSString *, NSString *> *)attributes; |
| 37 | +``` |
| 38 | + |
| 39 | +* Introduces Feature Variables to configure or parameterize your feature. There are four variable types: `BOOL`, `double`, `int`, `NSString*`. Note that unlike the Variable APIs, the Feature Variable APIs do not dispatch impression events. Instead, first call `isFeatureEnabled` to activate your experiments, then retrieve your variables. |
| 40 | +``` |
| 41 | +/** |
| 42 | + * API's that get feature variable values. |
| 43 | + * @param featureKey The key for the feature flag. |
| 44 | + * @param variableKey The key for the variable. |
| 45 | + * @param userId The user ID to be used for bucketing. |
| 46 | + * @param attributes The user's attributes. |
| 47 | + * @return feature variable value. |
| 48 | + */ |
| 49 | +- (BOOL)getFeatureVariableBoolean:(nullable NSString *)featureKey |
| 50 | + variableKey:(nullable NSString *)variableKey |
| 51 | + userId:(nullable NSString *)userId |
| 52 | + attributes:(nullable NSDictionary<NSString *, NSString *> *)attributes; |
| 53 | +- (double)getFeatureVariableDouble:(nullable NSString *)featureKey |
| 54 | + variableKey:(nullable NSString *)variableKey |
| 55 | + userId:(nullable NSString *)userId |
| 56 | + attributes:(nullable NSDictionary<NSString *, NSString *> *)attributes; |
| 57 | +- (int)getFeatureVariableInteger:(nullable NSString *)featureKey |
| 58 | + variableKey:(nullable NSString *)variableKey |
| 59 | + userId:(nullable NSString *)userId |
| 60 | + attributes:(nullable NSDictionary<NSString *, NSString *> *)attributes; |
| 61 | +- (NSString *_Nullable)getFeatureVariableString:(nullable NSString *)featureKey |
| 62 | + variableKey:(nullable NSString *)variableKey |
| 63 | + userId:(nullable NSString *)userId |
| 64 | + attributes:(nullable NSDictionary<NSString *, NSString *> *)attributes; |
| 65 | +``` |
| 66 | + |
| 67 | +* Introducing Optimizely Notification Center with Notification Listeners |
| 68 | +Optimizely object now has a Notification Center |
| 69 | +``` |
| 70 | + @property (nonatomic, strong, readonly, nullable) OPTLYNotificationCenter *notificationCenter; |
| 71 | +``` |
| 72 | +with Notification Listeners APIs |
| 73 | +``` |
| 74 | +- (NSInteger)addActivateNotificationListener:(nonnull ActivateListener)activateListener; |
| 75 | +- (NSInteger)addTrackNotificationListener:(TrackListener _Nonnull )trackListener; |
| 76 | +- (BOOL)removeNotificationListener:(NSUInteger)notificationId; |
| 77 | +- (void)clearNotificationListeners:(OPTLYNotificationType)type; |
| 78 | +- (void)clearAllNotificationListeners; |
| 79 | +``` |
| 80 | + |
| 81 | +* Introduces SDK Keys, which allow you to use Environments with the Objective-C SDK. Use an SDK Key to initialize your OptimizelyManager, and the SDK will retrieve the datafile for the environment associated with the SDK Key. This replaces initialization with Project ID. |
| 82 | +``` |
| 83 | +// Create the manager and set the datafile manager |
| 84 | + OPTLYManager *manager = [OPTLYManager init:^(OPTLYManagerBuilder * _Nullable builder) { |
| 85 | + builder.sdkKey = @"SDK_KEY_HERE"; |
| 86 | + }]; |
| 87 | +``` |
| 88 | + |
| 89 | +### Deprecations |
| 90 | +* Version 2.1.0 deprecates the Variable APIs: `variableBoolean`, `variableDouble`, `variableInteger`, and `variableString` |
| 91 | + |
| 92 | +* Replace use of the Variable APIs with Feature Mangement's Feature Variable APIs, described above |
| 93 | + |
| 94 | +* We will continue to support the Variable APIs until the 3.x release, but we encourage you to upgrade as soon as possible |
| 95 | + |
| 96 | +* You will see a deprecation warning if using a 2.x SDK with the deprecated Variable APIs, but the APIs will continue to behave as they did in 1.x versions of the SDK |
| 97 | + |
| 98 | +### Upgrading from 1.x |
| 99 | + |
| 100 | +In order to begin using Feature Management, you must discontinue use of 1.x variables in your experiments. First, pause and archive all experiments that use variables. Then, contact [Optimizely Support](https://optimizely.zendesk.com/hc/en-us/requests) in order to have your project converted from the 1.x SDK UI to the 2.x SDK UI. In addition to granting access to the Feature Management UI, upgrading to the 2.x SDK UI grants you access to [Environments](https://developers.optimizely.com/x/solutions/sdks/reference/?language=objectivec#environments) and other new features. |
| 101 | +* *Note*: All future feature development on the Objective-C SDK will assume that your are using the 2.x SDK UI, so we encourage you to upgrade as soon as possible. |
| 102 | + |
| 103 | + |
| 104 | +### Breaking changes |
| 105 | +* The `track` API with revenue value as a stand-alone parameter has been removed. The revenue value should be passed in as an entry of the event tags map. The key for the revenue tag is `revenue` and will be treated by Optimizely as the key for analyzing revenue data in results. |
| 106 | +``` |
| 107 | +NSDictionary *tags = @{@"revenue" : @6432}; |
| 108 | + // reserved "revenue" tag |
| 109 | +[optimizelyClient track:@"event_key" userId:@"user_1" attributes:nil eventTags:tags]; |
| 110 | +``` |
| 111 | + |
| 112 | +* We have removed deprecated classes with the `OPTLYNotificationBroadcaster` in favor of the new API with the `OPTLYNotificationCenter`. We have also added some convenience methods to add these listeners. Finally, some of the API names have changed slightly (e.g. `clearAllNotifications` is now `clearAllNotificationListener`) |
| 113 | + |
| 114 | + |
2 | 115 | ## 2.0.2-beta4
|
3 | 116 | August 1, 2018
|
4 | 117 |
|
|
0 commit comments