{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","params":[],"results":{"codes":[]},"settings":""},"next":{"description":"","pages":[]},"title":"Running the Pulsate SDK","type":"basic","slug":"running-the-pulsate-sdk-1","excerpt":"","body":"Before trying to run Pulsate make sure you have properly installed Pulsate - https://pulsate.readme.io/v2.7/docs/installing-the-ios-pulsate-sdk\n[block:api-header]\n{\n  \"title\": \"1. Initializing PULPulsateFactory\"\n}\n[/block]\nThe PULPulsateFactory creates and holds the Pulsate Manager instance, making sure there's only one per application. For Pulsate to properly work you must initialize it in the *application:didFinishLaunchingWithOptions* method of your *AppDelegate*.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"#import <PULPulsate/PULPulsate.h>\\n\\n:::at:::implementation AppDelegate\\n\\n- (BOOL)application:(UIApplication *)application\\n  didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\\n    NSError* authError;\\n\\n\\t\\tPULAuthorizationData* authData = [[PULAuthorizationData alloc] initWithAppId:@\\\"YOUR_SDK_APP_ID\\\" andAppKey:@\\\"YOUR_SDK_APP_KEY\\\" validationError:&authError];\\n\\n    if (authError == nill)\\n    {\\n        NSError* managerError;\\n        PULPulsateManager* pulsateManager = [PULPulsateFactory getInstanceWithAuthorizationData:authData withLocationEnabled:YES withPushEnabled:YES withLaunchOptions:launchOptions error:&managerError];\\n      \\n        if (managerError == nil)\\n        {\\n            [_pulsateManager startPulsateSession::^(BOOL success, NSError* error) {}];\\n        }\\n    }\\n    return YES;\\n}\\n\\n\\[email protected]\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"import PULPulsate\\n\\nclass AppDelegate {\\n\\n\\t  func application(_ application: UIApplication, \\n    didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool\\n    {\\n        do\\n        {\\n            let authData: PULAuthorizationData = try PULAuthorizationData(appId: \\\"YOUR_SDK_APP_ID\\\", andAppKey: \\\"YOUR_SDK_APP_KEY\\\");\\n      \\n            let pulsateManager = try PULPulsateFactory.getInstanceWith(authData,\\n            withLocationEnabled: true, withPushEnabled: true, \\n            withLaunchOptions: launchOptions, withPulsateAppDelegate: true);\\n      \\n            pulsateManager.startPulsateSession();\\n        } catch {\\n    \\t      print(error);\\n        }\\n        return true;\\n    }\\n}\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\niOS enables CoreLocation to wake up terminated apps so they can react to geofences and beacons. In order for that functionality to work you need to initialize the Pulsate SDK in the *application:didFinishLaunchingWithOptions* method of your *AppDelegate* and pass the *launchOptions* dictionary to Pulsate.\n\nAfter you successfully initialize *PULPulsateFactory* and create a *PULPulsateManager* you can later access the *PULPulsateManager* anywhere in your App by using the *getDefaultInstance* method.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"PULPulsateManager* pulsateManager = [PULPulsateFactory getDefaultInstance];\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"let pulsateManager = PULPulsateFactory.getDefaultInstance()\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"Pulsate SDK sets a new delegate for *UIApplication* so it can do all the heavy lifting for you. \\nYou will receive all *UIApplicationDelegate* callbacks, as they are forwarded to the original AppDelegate. \\n\\nRemember to not to change the *delegate* property of *UIApplication* after instantiating Pulsate.\",\n  \"title\": \"\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"2. Authorization Keys\"\n}\n[/block]\nSDK App ID and SDK App Key are used to associate the Pulsate framework with your Pulsate application which was created using Pulsate web panel.\n\nSDK App ID and SDK App Key can be found in your app settings screen. To find them log into the Pulsate web interface and click the **CONFIGURE** icon on the main menu, your ID and KEY will be displayed here.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/8d58099-SDK_Connect.png\",\n        \"SDK Connect.png\",\n        2380,\n        378,\n        \"#e3e3e3\"\n      ]\n    }\n  ]\n}\n[/block]\nYou need to instantiate the *PULAuthorizationData* object with these keys: \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"NSError* error;\\n\\nPULAuthorizationData* authData = [[PULAuthorizationData alloc] initWithAppId:@\\\"YOUR_SDK_APP_ID\\\" andAppKey:@\\\"YOUR_SDK_APP_KEY\\\" validationError:&error];\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"let authData: PULAuthorizationData = try PULAuthorizationData(appId: \\\"YOUR_SDK_APP_ID\\\", andAppKey: \\\"YOUR_SDK_APP_KEY\\\");\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]","updates":[],"order":1,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"5f44d586e97fd00021edf708","createdAt":"2020-08-25T09:10:30.529Z","user":"57bc3654b9c7f0220009c77b","category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"SDK Quick Start","slug":"sdk-quick-start","order":1,"from_sync":false,"reference":false,"_id":"5f44d1fbd1c58d040fdf03ba","createdAt":"2020-08-25T08:55:23.033Z","version":"5e5013741b3b20006532951d","project":"54aa7f773b56130b0056c86e","__v":0},"version":{"version":"2.7","version_clean":"2.7.0","codename":"iOS SDK","is_stable":false,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["5e5013741b3b200065329486","55781fe35129590d003ff4f9","55781fe35129590d003ff4fa","5e5013741b3b200065329487","5e5013741b3b200065329488","5e5013741b3b200065329489","5e5013741b3b20006532948a","5e5013741b3b20006532948b","565b66c446118c0d00dcb0bb","56898269f8dc340d00308c13","5e5013741b3b20006532948c","5e5013741b3b20006532948d","5c73dd27e8fdc000572a206a","5e5013741b3b20006532948e","5e53d9a2f75c0b0020de8935","5f44d1fbd1c58d040fdf03ba","5f44d202a2e3eb02b1c4c806","5f44d209703f05006a2a4fa9","5f44d210b1ba9f004200b689"],"_id":"5e5013741b3b20006532951d","project":"54aa7f773b56130b0056c86e","forked_from":"5e4fbbbda8fb41028f1861fe","__v":5,"createdAt":"2015-06-10T11:30:42.700Z","releaseDate":"2015-06-10T11:30:42.700Z"},"project":"54aa7f773b56130b0056c86e","__v":0,"parentDoc":null}

Running the Pulsate SDK


Before trying to run Pulsate make sure you have properly installed Pulsate - https://pulsate.readme.io/v2.7/docs/installing-the-ios-pulsate-sdk [block:api-header] { "title": "1. Initializing PULPulsateFactory" } [/block] The PULPulsateFactory creates and holds the Pulsate Manager instance, making sure there's only one per application. For Pulsate to properly work you must initialize it in the *application:didFinishLaunchingWithOptions* method of your *AppDelegate*. [block:code] { "codes": [ { "code": "#import <PULPulsate/PULPulsate.h>\n\[email protected] AppDelegate\n\n- (BOOL)application:(UIApplication *)application\n didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n NSError* authError;\n\n\t\tPULAuthorizationData* authData = [[PULAuthorizationData alloc] initWithAppId:@\"YOUR_SDK_APP_ID\" andAppKey:@\"YOUR_SDK_APP_KEY\" validationError:&authError];\n\n if (authError == nill)\n {\n NSError* managerError;\n PULPulsateManager* pulsateManager = [PULPulsateFactory getInstanceWithAuthorizationData:authData withLocationEnabled:YES withPushEnabled:YES withLaunchOptions:launchOptions error:&managerError];\n \n if (managerError == nil)\n {\n [_pulsateManager startPulsateSession::^(BOOL success, NSError* error) {}];\n }\n }\n return YES;\n}\n\n\[email protected]", "language": "objectivec" } ] } [/block] [block:code] { "codes": [ { "code": "import PULPulsate\n\nclass AppDelegate {\n\n\t func application(_ application: UIApplication, \n didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool\n {\n do\n {\n let authData: PULAuthorizationData = try PULAuthorizationData(appId: \"YOUR_SDK_APP_ID\", andAppKey: \"YOUR_SDK_APP_KEY\");\n \n let pulsateManager = try PULPulsateFactory.getInstanceWith(authData,\n withLocationEnabled: true, withPushEnabled: true, \n withLaunchOptions: launchOptions, withPulsateAppDelegate: true);\n \n pulsateManager.startPulsateSession();\n } catch {\n \t print(error);\n }\n return true;\n }\n}", "language": "swift" } ] } [/block] iOS enables CoreLocation to wake up terminated apps so they can react to geofences and beacons. In order for that functionality to work you need to initialize the Pulsate SDK in the *application:didFinishLaunchingWithOptions* method of your *AppDelegate* and pass the *launchOptions* dictionary to Pulsate. After you successfully initialize *PULPulsateFactory* and create a *PULPulsateManager* you can later access the *PULPulsateManager* anywhere in your App by using the *getDefaultInstance* method. [block:code] { "codes": [ { "code": "PULPulsateManager* pulsateManager = [PULPulsateFactory getDefaultInstance];", "language": "objectivec" } ] } [/block] [block:code] { "codes": [ { "code": "let pulsateManager = PULPulsateFactory.getDefaultInstance()", "language": "swift" } ] } [/block] [block:callout] { "type": "info", "body": "Pulsate SDK sets a new delegate for *UIApplication* so it can do all the heavy lifting for you. \nYou will receive all *UIApplicationDelegate* callbacks, as they are forwarded to the original AppDelegate. \n\nRemember to not to change the *delegate* property of *UIApplication* after instantiating Pulsate.", "title": "" } [/block] [block:api-header] { "type": "basic", "title": "2. Authorization Keys" } [/block] SDK App ID and SDK App Key are used to associate the Pulsate framework with your Pulsate application which was created using Pulsate web panel. SDK App ID and SDK App Key can be found in your app settings screen. To find them log into the Pulsate web interface and click the **CONFIGURE** icon on the main menu, your ID and KEY will be displayed here. [block:image] { "images": [ { "image": [ "https://files.readme.io/8d58099-SDK_Connect.png", "SDK Connect.png", 2380, 378, "#e3e3e3" ] } ] } [/block] You need to instantiate the *PULAuthorizationData* object with these keys: [block:code] { "codes": [ { "code": "NSError* error;\n\nPULAuthorizationData* authData = [[PULAuthorizationData alloc] initWithAppId:@\"YOUR_SDK_APP_ID\" andAppKey:@\"YOUR_SDK_APP_KEY\" validationError:&error];", "language": "objectivec" } ] } [/block] [block:code] { "codes": [ { "code": "let authData: PULAuthorizationData = try PULAuthorizationData(appId: \"YOUR_SDK_APP_ID\", andAppKey: \"YOUR_SDK_APP_KEY\");", "language": "swift" } ] } [/block]