{"__v":1,"_id":"57b96d6c1d08500e00bf8229","category":{"__v":0,"_id":"57b96d6b1d08500e00bf81d2","project":"54861bb654b3ce0b00367292","version":"57b96d6b1d08500e00bf81d1","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-03-22T15:19:16.310Z","from_sync":false,"order":0,"slug":"intigration","title":"iOS / Essentials KIt"},"parentDoc":null,"project":"54861bb654b3ce0b00367292","user":"54861b9f3681d914006992a4","version":{"__v":7,"_id":"57b96d6b1d08500e00bf81d1","project":"54861bb654b3ce0b00367292","createdAt":"2016-08-21T08:59:23.326Z","releaseDate":"2016-08-21T08:59:23.326Z","categories":["57b96d6b1d08500e00bf81d2","57b96d6b1d08500e00bf81d3","57b96d6b1d08500e00bf81d4","57b96d6b1d08500e00bf81d5","57b96d6b1d08500e00bf81d6","57b96d6b1d08500e00bf81d7","57b96d6b1d08500e00bf81d8","57b96d6b1d08500e00bf81d9","57b96d6b1d08500e00bf81da","57b96d6b1d08500e00bf81db","57b96d6b1d08500e00bf81dc","57b97748306b9b0e001dd53f","57d12c6c1227b40e0044908a","57d51ad68191880e008bb51b","57d52b5cf350090e00fe073e","57d5468a17b492170053a3f0","57df9df05927cb0e002bce1e"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":false,"codename":"","version_clean":"4.0.0","version":"4.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-12-08T15:02:41.975Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":4,"body":"[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"//\\n//  AppDelegate.m\\n//\\n//  Created by Tomer Shkolnik.\\n//  Copyright © 2016 elasticode. All rights reserved.\\n//\\n\\n#import \\\"AppDelegate.h\\\"\\n#import <ElastiCode/ElastiCode.h>\\n:::at:::interface AppDelegate ()\\n@end\\n\\n@implementation AppDelegate\\n\\n- (BOOL)application:(UIApplication *)application \\n  didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\\n\\n\\t\\t// basic setup  \\n    [ElastiCode setAPIKey:@\\\"<APIKey>\\\"]; \\n  \\t[ElastiCode setOnLaunchCompletionBlock:^(BOOL didAppear) {}];\\n\\n    // Uncomment to add actions\\n    //ECOnBoardingAction * ac = [ECOnBoardingAction createWithName:@\\\"show video\\\" actionWithContext:^(NSDictionary *context) {}];\\n\\t\\t//[ElastiCode setActions:@[ac]];\\n    \\n    // Uncomment to set third party analytics\\n    //[ElastiCode setThirdPartyAnalytics:@\\\"Mixpanel\\\" action:^(NSString * _Nonnull eventName) {\\n        //NSLog(@\\\"Mixpanel event : %@\\\", eventName);\\n        //[mixpanel track:eventName properties:@{@\\\"Source\\\": @\\\"Elasticode\\\"}];\\n\\t\\t//}];\\n    \\n    [ElastiCode ready];\\n    \\n    return YES;\\n}\\n- (void)applicationWillResignActive:(UIApplication *)application {}\\n- (void)applicationDidEnterBackground:(UIApplication *)application {}\\n- (void)applicationWillEnterForeground:(UIApplication *)application {}\\n- (void)applicationDidBecomeActive:(UIApplication *)application {}\\n- (void)applicationWillTerminate:(UIApplication *)application {}\\n\\n@end\\n  \",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"//\\n//  AppDelegate.swift\\n//\\n//  Created by Tomer Shkolnik.\\n//  Copyright © 2016 elasticode. All rights reserved.\\n//\\n\\nimport UIKit\\n\\n@UIApplicationMain\\nclass AppDelegate: UIResponder, UIApplicationDelegate {\\n\\n    var window: UIWindow?\\n    \\n    func application(application: UIApplication, didFinishLaunchingWithOptions\\n        launchOptions: [NSObject: AnyObject]?) -> Bool {\\n\\t\\t\\t\\t\\n        // basic setup\\n     \\t\\tElastiCode.setAPIKey(\\\"<APIKey>\\\")\\n\\t\\t    ElastiCode.setOnBoardingCompletionBlock { (didAppear) in   }\\n        \\n        // Uncomment to add actions\\n\\t    \\t//ElastiCode.setActions([\\n\\t\\t\\t  //ECOnBoardingAction .createWithName(\\\"Show video\\\",\\n    \\t\\t//action: { (dict) -> Void in\\n      \\t//\\t// video showing logic\\n    \\t\\t//})]\\n\\t\\t\\t\\t//)\\n    \\n    \\t\\t// Uncomment to set third party analytics\\n\\t\\t    //ElastiCode.setThirdPartyAnalytics(\\\"Mixpanel\\\") \\n\\t\\t\\t\\t//{ (eventName) -> Void in\\n\\t\\t\\t\\t//   print(\\\"Mixpanel event - %s\\\", eventName);\\n\\t\\t\\t\\t//  mixpanel.track(eventName,properties: [])\\n\\t\\t\\t\\t//}\\n        \\n\\t\\t    ElastiCode.ready()    \\n        return true\\n    }\\n    func applicationWillResignActive(application: UIApplication) {}\\n    func applicationDidEnterBackground(application: UIApplication) {}\\n    func applicationWillEnterForeground(application: UIApplication) {}\\n    func applicationDidBecomeActive(application: UIApplication) {}\\n    func applicationWillTerminate(application: UIApplication) {}\\n}\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]","excerpt":"iOS / Essentials KIt: AppDelegate Example","slug":"appdelegate-example","type":"basic","title":"AppDelegate Example"}

AppDelegate Example

iOS / Essentials KIt: AppDelegate Example

[block:code] { "codes": [ { "code": "//\n// AppDelegate.m\n//\n// Created by Tomer Shkolnik.\n// Copyright © 2016 elasticode. All rights reserved.\n//\n\n#import \"AppDelegate.h\"\n#import <ElastiCode/ElastiCode.h>\n@interface AppDelegate ()\n@end\n\n@implementation AppDelegate\n\n- (BOOL)application:(UIApplication *)application \n didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n\n\t\t// basic setup \n [ElastiCode setAPIKey:@\"<APIKey>\"]; \n \t[ElastiCode setOnLaunchCompletionBlock:^(BOOL didAppear) {}];\n\n // Uncomment to add actions\n //ECOnBoardingAction * ac = [ECOnBoardingAction createWithName:@\"show video\" actionWithContext:^(NSDictionary *context) {}];\n\t\t//[ElastiCode setActions:@[ac]];\n \n // Uncomment to set third party analytics\n //[ElastiCode setThirdPartyAnalytics:@\"Mixpanel\" action:^(NSString * _Nonnull eventName) {\n //NSLog(@\"Mixpanel event : %@\", eventName);\n //[mixpanel track:eventName properties:@{@\"Source\": @\"Elasticode\"}];\n\t\t//}];\n \n [ElastiCode ready];\n \n return YES;\n}\n- (void)applicationWillResignActive:(UIApplication *)application {}\n- (void)applicationDidEnterBackground:(UIApplication *)application {}\n- (void)applicationWillEnterForeground:(UIApplication *)application {}\n- (void)applicationDidBecomeActive:(UIApplication *)application {}\n- (void)applicationWillTerminate:(UIApplication *)application {}\n\n@end\n ", "language": "objectivec" }, { "code": "//\n// AppDelegate.swift\n//\n// Created by Tomer Shkolnik.\n// Copyright © 2016 elasticode. All rights reserved.\n//\n\nimport UIKit\n\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n\n var window: UIWindow?\n \n func application(application: UIApplication, didFinishLaunchingWithOptions\n launchOptions: [NSObject: AnyObject]?) -> Bool {\n\t\t\t\t\n // basic setup\n \t\tElastiCode.setAPIKey(\"<APIKey>\")\n\t\t ElastiCode.setOnBoardingCompletionBlock { (didAppear) in }\n \n // Uncomment to add actions\n\t \t//ElastiCode.setActions([\n\t\t\t //ECOnBoardingAction .createWithName(\"Show video\",\n \t\t//action: { (dict) -> Void in\n \t//\t// video showing logic\n \t\t//})]\n\t\t\t\t//)\n \n \t\t// Uncomment to set third party analytics\n\t\t //ElastiCode.setThirdPartyAnalytics(\"Mixpanel\") \n\t\t\t\t//{ (eventName) -> Void in\n\t\t\t\t// print(\"Mixpanel event - %s\", eventName);\n\t\t\t\t// mixpanel.track(eventName,properties: [])\n\t\t\t\t//}\n \n\t\t ElastiCode.ready() \n return true\n }\n func applicationWillResignActive(application: UIApplication) {}\n func applicationDidEnterBackground(application: UIApplication) {}\n func applicationWillEnterForeground(application: UIApplication) {}\n func applicationDidBecomeActive(application: UIApplication) {}\n func applicationWillTerminate(application: UIApplication) {}\n}", "language": "swift" } ] } [/block]