Skip to content

Instantly share code, notes, and snippets.

@mauerbac
Created January 14, 2017 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mauerbac/8243dce3884b460271a0ca9673f84fae to your computer and use it in GitHub Desktop.
Save mauerbac/8243dce3884b460271a0ca9673f84fae to your computer and use it in GitHub Desktop.
Code snippet for iOS getting started (Objective-C)
//
// AppDelegate.m
// iOS Getting Started Guide (Objective C)
#import "AppDelegate.h"
#import <OptimizelySDKiOS/OptimizelySDKiOS.h>
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
OPTLYManager *manager = [OPTLYManager init:^(OPTLYManagerBuilder * _Nullable builder) {
builder.projectId = @"project_id";
}];
[manager initializeWithCallback:^(NSError * _Nullable error, OPTLYClient * _Nullable client) {
OPTLYVariation *variation = [client activate:@"my_experiment" userId:@"currentUser"];
[client track:@"my_conversion" userId:@"currentUser"];
}];
return YES;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment