{"_id":"58aad9df8f862f250076fa4f","project":"54aa7f773b56130b0056c86e","category":{"_id":"58aad9dd8f862f250076f9f7","version":"58aad9dd8f862f250076f9f4","project":"54aa7f773b56130b0056c86e","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-01-05T12:43:51.897Z","from_sync":false,"order":3,"slug":"ios-sdk","title":"iOS SDK"},"user":"54aa7f3f9bb00c0b00cb899b","version":{"_id":"58aad9dd8f862f250076f9f4","project":"54aa7f773b56130b0056c86e","__v":2,"createdAt":"2017-02-20T11:58:21.765Z","releaseDate":"2017-02-20T11:58:21.765Z","categories":["58aad9dd8f862f250076f9f5","58aad9dd8f862f250076f9f6","58aad9dd8f862f250076f9f7","58aad9dd8f862f250076f9f8","58aad9dd8f862f250076f9f9","58aad9dd8f862f250076f9fa","58aad9dd8f862f250076f9fb","58ac26b3d460ce2500185d26"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":false,"codename":"Locate","version_clean":"6.0.0","version":"6.0"},"__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-06-11T15:38:07.351Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"The Locate iOS SDK is a static library built with slices for arm7, arm64 and simulator architecture. It's a bridge between your customers' mobile devices and the Pulsate server. **The SDK Supports iOS 8.0 +**. It's very easy to use, and even easier to install thanks to the [CocoaPods](https://cocoapods.org/) dependency manager.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Step 1: Setup CocoaPods\"\n}\n[/block]\nCocoaPods is built in Ruby and you can install it with the Terminal:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ sudo gem install cocoapods\",\n      \"language\": \"shell\",\n      \"name\": null\n    }\n  ]\n}\n[/block]\nAfter you install CocoaPods, you can setup the files needed to integrate by going to your XCode project folder and running:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ pod init\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nIf you have any problems, please refer to the official [CocoaPods Getting Started](http://guides.cocoapods.org/using/getting-started.html) document.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Step 2: Installing dependencies\"\n}\n[/block]\nThe last step should produce the *Podfile* file, where you declare all your dependencies. You need to add a *LOCLocate* dependency:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"# Uncomment this line if you're using Swift\\n# use_frameworks!\\n\\ntarget 'PulsateDemoProject' do\\n\\npod 'LOCLocate'\\n\\nend\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nAfter saving the *Podfile* you can run the command that will install your dependencies and set your project to use them:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ pod install\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"After integrating CocoaPods with your project, please remember to always use the \\\\*.xcworkspace file, not \\\\*.xcodeproj to open your project.\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Manual installation\",\n  \"body\": \"It is highly recommended to use CocoaPods to integrate Pulsate with your project. If you wish to install the SDK manually please refer to the [Manually Installing the Pulsate SDK](http://pulsate.readme.io/v2.0/docs/manually-installing-the-pulsate-sdk) guide.\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"Updating your pods\",\n  \"body\": \"You can update your pods by using:\\n\\n*$ pod update*\\n\\nPlease be careful when updating the LOCLocate pod. It'll overwrite all the UI and language customizations you might have in your LOCLocate.bundle. Please keep a copy of your customizations when updating.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Step 3: Adding CoreLocation Authorization Key\"\n}\n[/block]\niOS 8.0 and later requires adding a certain key to your *.plist file for CoreLocation to work.\n\nAdd the *NSLocationAlwaysUsageDescription* key to your project’s *Info.plist* containing the message to be displayed to the user at the prompt.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/VVH4FbT5S9xJYElMySGw_plist-key-value.png\",\n        \"plist-key-value.png\",\n        \"1221\",\n        \"380\",\n        \"#1e3f70\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Example Description Value\",\n  \"body\": \"\\\"We use this to provide the best experience possible inside our store. We also send relevant communications based on your location.\\\"\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"When In Use Permission\",\n  \"body\": \"If your app already has the *When In Use* permission, there's no way to show the location prompt second time. The only way for the users to update the permission from *When In Use* to *Always* is in the settings. You can open the settings for the user programatically:\\n\\n `NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];`\\n `[[UIApplication sharedApplication] openURL:url];`\\n\\n or send them a campaign with `app-settings:` deeplink.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Step 4: Adding Background Location Updates (Optional)\"\n}\n[/block]\nTo use polygonal geofences, the Locate SDK requires Background Location Updates to be active. To turn on Background Location Updates open your project in xCode and select your project target. Under Capabilities you can find \"Background Modes\" open the list and select \"Location updates\".\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"App Store\",\n  \"body\": \"If your app uses Background Location Updates you must add this line to the apps description on App Store - \\\"Continued use of GPS running in the background can dramatically decrease battery life\\\".\"\n}\n[/block]","excerpt":"","slug":"installing-the-pulsate-sdk","type":"basic","title":"Installing iOS SDK using CocoaPods"}

Installing iOS SDK using CocoaPods


The Locate iOS SDK is a static library built with slices for arm7, arm64 and simulator architecture. It's a bridge between your customers' mobile devices and the Pulsate server. **The SDK Supports iOS 8.0 +**. It's very easy to use, and even easier to install thanks to the [CocoaPods](https://cocoapods.org/) dependency manager. [block:api-header] { "type": "basic", "title": "Step 1: Setup CocoaPods" } [/block] CocoaPods is built in Ruby and you can install it with the Terminal: [block:code] { "codes": [ { "code": "$ sudo gem install cocoapods", "language": "shell", "name": null } ] } [/block] After you install CocoaPods, you can setup the files needed to integrate by going to your XCode project folder and running: [block:code] { "codes": [ { "code": "$ pod init", "language": "shell" } ] } [/block] If you have any problems, please refer to the official [CocoaPods Getting Started](http://guides.cocoapods.org/using/getting-started.html) document. [block:api-header] { "type": "basic", "title": "Step 2: Installing dependencies" } [/block] The last step should produce the *Podfile* file, where you declare all your dependencies. You need to add a *LOCLocate* dependency: [block:code] { "codes": [ { "code": "# Uncomment this line if you're using Swift\n# use_frameworks!\n\ntarget 'PulsateDemoProject' do\n\npod 'LOCLocate'\n\nend", "language": "text" } ] } [/block] After saving the *Podfile* you can run the command that will install your dependencies and set your project to use them: [block:code] { "codes": [ { "code": "$ pod install", "language": "text" } ] } [/block] [block:callout] { "type": "info", "body": "After integrating CocoaPods with your project, please remember to always use the \\*.xcworkspace file, not \\*.xcodeproj to open your project." } [/block] [block:callout] { "type": "info", "title": "Manual installation", "body": "It is highly recommended to use CocoaPods to integrate Pulsate with your project. If you wish to install the SDK manually please refer to the [Manually Installing the Pulsate SDK](http://pulsate.readme.io/v2.0/docs/manually-installing-the-pulsate-sdk) guide." } [/block] [block:callout] { "type": "danger", "title": "Updating your pods", "body": "You can update your pods by using:\n\n*$ pod update*\n\nPlease be careful when updating the LOCLocate pod. It'll overwrite all the UI and language customizations you might have in your LOCLocate.bundle. Please keep a copy of your customizations when updating." } [/block] [block:api-header] { "type": "basic", "title": "Step 3: Adding CoreLocation Authorization Key" } [/block] iOS 8.0 and later requires adding a certain key to your *.plist file for CoreLocation to work. Add the *NSLocationAlwaysUsageDescription* key to your project’s *Info.plist* containing the message to be displayed to the user at the prompt. [block:image] { "images": [ { "image": [ "https://files.readme.io/VVH4FbT5S9xJYElMySGw_plist-key-value.png", "plist-key-value.png", "1221", "380", "#1e3f70", "" ] } ] } [/block] [block:callout] { "type": "info", "title": "Example Description Value", "body": "\"We use this to provide the best experience possible inside our store. We also send relevant communications based on your location.\"" } [/block] [block:callout] { "type": "warning", "title": "When In Use Permission", "body": "If your app already has the *When In Use* permission, there's no way to show the location prompt second time. The only way for the users to update the permission from *When In Use* to *Always* is in the settings. You can open the settings for the user programatically:\n\n `NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];`\n `[[UIApplication sharedApplication] openURL:url];`\n\n or send them a campaign with `app-settings:` deeplink." } [/block] [block:api-header] { "type": "basic", "title": "Step 4: Adding Background Location Updates (Optional)" } [/block] To use polygonal geofences, the Locate SDK requires Background Location Updates to be active. To turn on Background Location Updates open your project in xCode and select your project target. Under Capabilities you can find "Background Modes" open the list and select "Location updates". [block:callout] { "type": "warning", "title": "App Store", "body": "If your app uses Background Location Updates you must add this line to the apps description on App Store - \"Continued use of GPS running in the background can dramatically decrease battery life\"." } [/block]