{"__v":26,"_id":"55f196903936d52d00fb3c95","category":{"__v":15,"_id":"55f1962e3936d52d00fb3c8f","pages":["55f196903936d52d00fb3c95","55f19c267dccfc0d00986b44","55f19da95fe76419007dc732","55f19ea639e3e8190068b2cc","55f19f7c7dccfc0d00986b4b","55f19fff3936d52d00fb3ca1","55f1a06d39e3e8190068b2d2","55f1a0925fe76419007dc737","55f1a0cb3936d52d00fb3cab","55f1b2be7dccfc0d00986b72","55f1b7d139e3e8190068b300","55f1b7fb229b772300779a4a","55f1be1efd98c42300acc64f","560956518aedf50d0004d0e2","565380daf77ca023004e5321"],"project":"55de06fa57f7b20d0097636b","version":"55de06fa57f7b20d0097636e","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-09-10T14:39:42.948Z","from_sync":false,"order":1,"slug":"ios-sdk","title":"iOS SDK"},"parentDoc":null,"project":"55de06fa57f7b20d0097636b","user":"55de06e19db51a0d0064947d","version":{"__v":10,"_id":"55de06fa57f7b20d0097636e","project":"55de06fa57f7b20d0097636b","createdAt":"2015-08-26T18:35:38.642Z","releaseDate":"2015-08-26T18:35:38.642Z","categories":["55de06fb57f7b20d0097636f","55f1962e3936d52d00fb3c8f","55f1970339e3e8190068b2b8","55f1970d229b772300779a1f","55f1971cfd98c42300acc605","55f1d5c7fd98c42300acc69f","563cbfe4260dde0d00c5e9d4","5644cf437f1fff210078e690","57dc1bbd3ed3450e00dc9ea7","58a600a2243dd30f00fd8773"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-09-10T14:41:20.194Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"Integrating the PushSpring SDK into your app is straightforward, with a basic integration taking around 15 minutes. More advanced integrations that take advantage of additional features, e.g. including custom event tracking (for rich segmentation of your users based on your own criteria), might take a few more minutes.\n\ntvOS is supported with minor changes to the integration instructions.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"1. Use CocoaPods\"\n}\n[/block]\nIf you are using CocoaPods then add the PushSpring SDK to your Podfile:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"pod 'PushSpring', '3.0.3'\",\n      \"language\": \"json\",\n      \"name\": \"iOS\"\n    },\n    {\n      \"code\": \"pod 'PushSpring/TV', '3.0.0'\",\n      \"language\": \"ruby\",\n      \"name\": \"tvOS\"\n    }\n  ]\n}\n[/block]\nRun 'pod install' to integrate the SDK with your project. Skip to [Step 3](http://docs.pushspring.com/docs/getting-started-1#3-compile-your-app-to-verify-sdk-integration) below to complete the integration.\n\nYou can find the latest version on the CocoaPods site: https://cocoapods.org/?q=pushspring\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"2. Manually add the SDK\"\n}\n[/block]\nIf you aren't using CocoaPods and wish to integrate the SDK manually then follow the instructions below.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"2a. Request SDK Binary\"\n}\n[/block]\nEmail <support:::at:::pushspring.com> for the binary and samples.\n\nInside the SDK, you’ll find a folder appropriate for your platform. If your app is for an iPhone or iPad, copy PushSpringSDK into your app’s source. If your app is for the Apple TV copy PushSpringTVSDK. \n\nYou’ll also find a complete sample app that uses the SDK in a folder called SDKSample inside the PushSpringiOSSamples ZIP archive.\n\nThere are no external dependencies for the SDK.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"2b. Adding the SDK to your XCode Project\"\n}\n[/block]\nOpen your app's project in Xcode. Right-click on your app's top-level group and select **'Add Files To <YourApp>'**. Add the entire **PushSpringSDK** or **PushSpringTVSDK** directory, depending on your platform, and choose to **'Create groups for any added folders'**.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/IFCb5xSCQOyHG74Eo2sv_add_sdk.png\",\n        \"add_sdk.png\",\n        \"1378\",\n        \"952\",\n        \"#295a94\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"2c. Required Frameworks\"\n}\n[/block]\nYou'll need to add certain iOS frameworks to your app that are needed by PushSpring.\n\nMake sure the following Frameworks are included in the list:\n\n* CoreLocation.framework (marked Optional)\n* AdSupport.framework\n* CoreTelephony.framework (exclude on tvOS)\n* libz.1.dylib\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/CsD4tLxkQGiLMhTjibgd_add_frameworks.png\",\n        \"add_frameworks.png\",\n        \"1412\",\n        \"1089\",\n        \"#9b532e\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"3. Compile your App to Verify SDK Integration\"\n}\n[/block]\nOnce you've added the SDK and the correct project configuration changes, we recommend doing a Clean and Build of your app to make sure nothing has been broken in the process. In particular, this step will tell you if you've missed one of the required frameworks needed by the SDK.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"4. Configuring your API Key\"\n}\n[/block]\nBefore getting started, get your app's API key from the PushSpring Audience Console. You'll use this API key when initializing the SDK in the following steps.  You can share API keys between Android and iOS versions of the same app if you like, but each separate app that you integrate the PushSpring SDK into should be given its own API key so the audiences are tracked independently by PushSpring.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/32fAEmN0SxiAlMuaslkv_Screen%20Shot%202015-12-01%20at%208.33.25%20PM.png\",\n        \"Screen Shot 2015-12-01 at 8.33.25 PM.png\",\n        \"2550\",\n        \"1162\",\n        \"#60463a\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"5. App Delegate Changes\"\n}\n[/block]\nUpdate your App Delegate to include the line:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"#import \\\"PushSpring.h\\\"\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\nNext, add the following line to your **application:didFinishLaunchingWithOptions:** method, replacing **YOUR-API-KEY** with the API key you got from the PushSpring dashboard.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[[PushSpring sharedPushSpring] application:application\\n        didFinishLaunchingWithOptions:launchOptions\\n        andApiKey:@\\\"YOUR-API-KEY\\\"];\\n\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"6. Complete!\"\n}\n[/block]\nYou have now completed a basic integration of PushSpring into your application.  See the following sections for additional detail and features you can take advantage of.","excerpt":"Initial integration with iOS SDK","slug":"getting-started-1","type":"basic","title":"Initial Integration"}

Initial Integration

Initial integration with iOS SDK

Integrating the PushSpring SDK into your app is straightforward, with a basic integration taking around 15 minutes. More advanced integrations that take advantage of additional features, e.g. including custom event tracking (for rich segmentation of your users based on your own criteria), might take a few more minutes. tvOS is supported with minor changes to the integration instructions. [block:api-header] { "type": "basic", "title": "1. Use CocoaPods" } [/block] If you are using CocoaPods then add the PushSpring SDK to your Podfile: [block:code] { "codes": [ { "code": "pod 'PushSpring', '3.0.3'", "language": "json", "name": "iOS" }, { "code": "pod 'PushSpring/TV', '3.0.0'", "language": "ruby", "name": "tvOS" } ] } [/block] Run 'pod install' to integrate the SDK with your project. Skip to [Step 3](http://docs.pushspring.com/docs/getting-started-1#3-compile-your-app-to-verify-sdk-integration) below to complete the integration. You can find the latest version on the CocoaPods site: https://cocoapods.org/?q=pushspring [block:api-header] { "type": "basic", "title": "2. Manually add the SDK" } [/block] If you aren't using CocoaPods and wish to integrate the SDK manually then follow the instructions below. [block:api-header] { "type": "basic", "title": "2a. Request SDK Binary" } [/block] Email <support@pushspring.com> for the binary and samples. Inside the SDK, you’ll find a folder appropriate for your platform. If your app is for an iPhone or iPad, copy PushSpringSDK into your app’s source. If your app is for the Apple TV copy PushSpringTVSDK. You’ll also find a complete sample app that uses the SDK in a folder called SDKSample inside the PushSpringiOSSamples ZIP archive. There are no external dependencies for the SDK. [block:api-header] { "type": "basic", "title": "2b. Adding the SDK to your XCode Project" } [/block] Open your app's project in Xcode. Right-click on your app's top-level group and select **'Add Files To <YourApp>'**. Add the entire **PushSpringSDK** or **PushSpringTVSDK** directory, depending on your platform, and choose to **'Create groups for any added folders'**. [block:image] { "images": [ { "image": [ "https://files.readme.io/IFCb5xSCQOyHG74Eo2sv_add_sdk.png", "add_sdk.png", "1378", "952", "#295a94", "" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "2c. Required Frameworks" } [/block] You'll need to add certain iOS frameworks to your app that are needed by PushSpring. Make sure the following Frameworks are included in the list: * CoreLocation.framework (marked Optional) * AdSupport.framework * CoreTelephony.framework (exclude on tvOS) * libz.1.dylib [block:image] { "images": [ { "image": [ "https://files.readme.io/CsD4tLxkQGiLMhTjibgd_add_frameworks.png", "add_frameworks.png", "1412", "1089", "#9b532e", "" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "3. Compile your App to Verify SDK Integration" } [/block] Once you've added the SDK and the correct project configuration changes, we recommend doing a Clean and Build of your app to make sure nothing has been broken in the process. In particular, this step will tell you if you've missed one of the required frameworks needed by the SDK. [block:api-header] { "type": "basic", "title": "4. Configuring your API Key" } [/block] Before getting started, get your app's API key from the PushSpring Audience Console. You'll use this API key when initializing the SDK in the following steps. You can share API keys between Android and iOS versions of the same app if you like, but each separate app that you integrate the PushSpring SDK into should be given its own API key so the audiences are tracked independently by PushSpring. [block:image] { "images": [ { "image": [ "https://files.readme.io/32fAEmN0SxiAlMuaslkv_Screen%20Shot%202015-12-01%20at%208.33.25%20PM.png", "Screen Shot 2015-12-01 at 8.33.25 PM.png", "2550", "1162", "#60463a", "" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "5. App Delegate Changes" } [/block] Update your App Delegate to include the line: [block:code] { "codes": [ { "code": "#import \"PushSpring.h\"", "language": "objectivec" } ] } [/block] Next, add the following line to your **application:didFinishLaunchingWithOptions:** method, replacing **YOUR-API-KEY** with the API key you got from the PushSpring dashboard. [block:code] { "codes": [ { "code": "[[PushSpring sharedPushSpring] application:application\n didFinishLaunchingWithOptions:launchOptions\n andApiKey:@\"YOUR-API-KEY\"];\n", "language": "objectivec" } ] } [/block] [block:api-header] { "type": "basic", "title": "6. Complete!" } [/block] You have now completed a basic integration of PushSpring into your application. See the following sections for additional detail and features you can take advantage of.