Skip to content

Commit 65c7d19

Browse files
fix json model problems so that you can access objects correctly (#329)
* fix json model problems so that you can access objects correctly * use the project config to correctly get experiments
1 parent ce6676c commit 65c7d19

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

OptimizelyDemoApp/AppDelegate.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
125125

126126
})
127127
#endif
128-
let variation = optimizelyClient?.activate((self?.experimentKey)!, userId: (self?.userId)!, attributes: (self?.attributes))
128+
let variation = optimizelyClient?.activate((self?.experimentKey)!, userId: (self?.userId)!)
129129

130+
if let experiments = optimizelyClient?.optimizely?.config?.experiments {
131+
for experiment in experiments {
132+
print(experiment.experimentKey)
133+
}
134+
}
130135
self?.setRootViewController(optimizelyClient: optimizelyClient, bucketedVariation:variation)
131136
})
132137

OptimizelySDKCore/OptimizelySDKCore/OPTLYProjectConfig.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,20 @@ NS_ASSUME_NONNULL_END
4949
/// Flag for Bot Filtering
5050
@property (nonatomic, strong, nonnull) NSNumber<OPTLYOptional> *botFiltering;
5151
/// List of Optimizely Experiment objects
52-
@property (nonatomic, strong, nonnull) NSArray<OPTLYExperiment> *experiments;
52+
@property (nonatomic, strong, nonnull) NSArray<OPTLYExperiment*><OPTLYExperiment> *experiments;
5353
/// List of Optimizely Event Type objects
54-
@property (nonatomic, strong, nonnull) NSArray<OPTLYEvent> *events;
54+
@property (nonatomic, strong, nonnull) NSArray<OPTLYEvent *><OPTLYEvent> *events;
5555
/// List of audience ids
56-
@property (nonatomic, strong, nonnull) NSArray<OPTLYAudience> *audiences;
56+
@property (nonatomic, strong, nonnull) NSArray<OPTLYAudience *><OPTLYAudience> *audiences;
5757
/// List of attributes objects
58-
@property (nonatomic, strong, nonnull) NSArray<OPTLYAttribute> *attributes;
58+
@property (nonatomic, strong, nonnull) NSArray<OPTLYAttribute*><OPTLYAttribute> *attributes;
5959
/// List of group objects
60-
@property (nonatomic, strong, nonnull) NSArray<OPTLYGroup> *groups;
60+
@property (nonatomic, strong, nonnull) NSArray<OPTLYGroup*><OPTLYGroup> *groups;
6161
/// List of live variable objects (DEPRECATED)
62-
@property (nonatomic, strong, nonnull) NSArray<OPTLYVariable, OPTLYOptional> *variables;
62+
@property (nonatomic, strong, nonnull) NSArray<OPTLYVariable *><OPTLYVariable, OPTLYOptional> *variables;
6363

6464
/// a comprehensive list of experiments that includes experiments being whitelisted (in Groups)
65-
@property (nonatomic, strong, nullable) NSArray<OPTLYExperiment, Ignore> *allExperiments;
65+
@property (nonatomic, strong, nullable) NSArray<OPTLYExperiment*><OPTLYExperiment, OPTLYOptional> *allExperiments;
6666
@property (nonatomic, strong, nullable) id<OPTLYLogger, Ignore> logger;
6767
@property (nonatomic, strong, nullable) id<OPTLYErrorHandler, Ignore> errorHandler;
6868
@property (nonatomic, strong, readonly, nullable) id<OPTLYUserProfileService, Ignore> userProfileService;
@@ -72,9 +72,9 @@ NS_ASSUME_NONNULL_END
7272
/// Returns the client version number
7373
@property (nonatomic, strong, readonly, nonnull) NSString<Ignore> *clientVersion;
7474
/// List of Optimizely Feature Flags objects
75-
@property (nonatomic, strong, nonnull) NSArray<OPTLYFeatureFlag, OPTLYOptional> *featureFlags;
75+
@property (nonatomic, strong, nonnull) NSArray<OPTLYFeatureFlag*><OPTLYFeatureFlag, OPTLYOptional> *featureFlags;
7676
/// List of Optimizely Rollouts objects
77-
@property (nonatomic, strong, nonnull) NSArray<OPTLYRollout, OPTLYOptional> *rollouts;
77+
@property (nonatomic, strong, nonnull) NSArray<OPTLYRollout*><OPTLYRollout, OPTLYOptional> *rollouts;
7878

7979
/**
8080
* Initialize the Project Config from a builder block.

0 commit comments

Comments
 (0)