Skip to content
This repository was archived by the owner on Apr 5, 2023. It is now read-only.

Commit 7003a14

Browse files
(Fix) fix audience combindations. (optimizely#357)
* fix audience combindations. but, not correctly * fixed properly
1 parent db72170 commit 7003a14

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

OptimizelySDKCore/OptimizelySDKCore/OPTLYExperiment.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,12 @@ + (OPTLYJSONKeyMapper*)keyMapper
4141
}
4242

4343
- (void)setAudienceConditionsWithNSString:(NSString *)string {
44-
NSError *err = nil;
4544
NSArray *array = [string getValidAudienceConditionsArray];
45+
[self setAudienceConditionsWithNSArray:array];
46+
}
47+
48+
- (void)setAudienceConditionsWithNSArray:(NSArray *)array {
49+
NSError *err = nil;
4650
self.audienceConditions = [OPTLYCondition deserializeAudienceConditionsJSONArray:array error:&err];
4751

4852
if (err != nil) {
@@ -52,6 +56,7 @@ - (void)setAudienceConditionsWithNSString:(NSString *)string {
5256
}
5357

5458
- (nullable NSNumber *)evaluateConditionsWithAttributes:(NSDictionary<NSString *, NSObject *> *)attributes projectConfig:(nullable OPTLYProjectConfig *)config {
59+
5560
for (NSObject<OPTLYCondition> *condition in self.audienceConditions) {
5661
NSNumber *result = [condition evaluateConditionsWithAttributes:attributes projectConfig:config];
5762
if (result != NULL && [result boolValue] == true) {

0 commit comments

Comments
 (0)