-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
20 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,20 +3,31 @@ | |
|
||
int main(int argc, const char * argv[]) { | ||
@autoreleasepool { | ||
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); | ||
|
||
ConfigCatClient* client = [ConfigCatClient getWithSdkKey:@"PKDVCLf-Hq-h-kCzMp-L7Q/HhOWfwVtZ0mb30i9wi17GQ" configurator:^(ConfigCatOptions* options){ | ||
// Info level logging helps to inspect the feature flag evaluation process. | ||
// Use the default Warning level to avoid too detailed logging in your application. | ||
options.logLevel = LogLevelInfo; | ||
|
||
[options.hooks addOnReadyWithHandler:^(enum ClientReadyState state) { | ||
dispatch_semaphore_signal(semaphore); | ||
}]; | ||
}]; | ||
|
||
dispatch_semaphore_wait(semaphore, dispatch_time(DISPATCH_TIME_NOW, (uint64_t)(5 * NSEC_PER_SEC))); | ||
|
||
// Creating a user object to identify your user (optional). | ||
ConfigCatUser* userObject = [[ConfigCatUser alloc]initWithIdentifier:@"Some UserID" | ||
email:@"[email protected]" | ||
country:@"CountryID" | ||
custom:@{@"version": @"1.0.0"}]; | ||
|
||
NSString *featureName = @"isPOCFeatureEnabled"; | ||
BOOL value = [client getBoolValueSyncFor:featureName defaultValue:false user:userObject]; | ||
|
||
ConfigCatSnapshot* snapshot = [client snapshot]; | ||
|
||
BOOL value = [snapshot getBoolValueFor:featureName defaultValue:false user:userObject]; | ||
NSLog(@"%@: %@", featureName, value ? @"Yes" : @"No"); | ||
} | ||
return 0; | ||
|