{"_id":"59e70b9fe027ae002e7d2f22","category":{"_id":"59e70b9ee027ae002e7d2ed4","version":"59e70b9ee027ae002e7d2ed2","project":"5496d393f52a630b00519cdd","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-12-01T11:28:38.565Z","from_sync":false,"order":1,"slug":"getting-started-ios","title":"iOS Reference"},"project":"5496d393f52a630b00519cdd","user":"5496d353f52a630b00519cdc","parentDoc":null,"version":{"_id":"59e70b9ee027ae002e7d2ed2","project":"5496d393f52a630b00519cdd","__v":2,"createdAt":"2017-10-18T08:06:54.462Z","releaseDate":"2017-10-18T08:06:54.462Z","categories":["59e70b9ee027ae002e7d2ed3","59e70b9ee027ae002e7d2ed4","59e70b9ee027ae002e7d2ed5","59e70b9ee027ae002e7d2ed6","59e70b9ee027ae002e7d2ed7","59e70b9ee027ae002e7d2ed8","59e70b9ee027ae002e7d2ed9","59e70b9ee027ae002e7d2eda","59e70b9ee027ae002e7d2edb","59e70b9ee027ae002e7d2edc","59e70b9ee027ae002e7d2edd","59e70b9ee027ae002e7d2ede","59e70b9ee027ae002e7d2edf","5b8661ccdd19310003a3fa0b"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"2.0.10","version":"2.0.10"},"githubsync":"","__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-12-01T11:37:16.743Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Activate the SDK\",\n  \"body\": \"Please follow our [Quick Start iOS guide](doc:ios) for SDK activation instructions.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Add custom data to User Info\"\n}\n[/block]\nIf known, it is highly recommended to set the user age and gender using the PLUserInfo constants (PLUserInfoGender, PLUserInfoBirthday, PLUserInfoAge, etc.). These data will be used to improve Placer's venue detection and profiling performance. \n\n\nYou may set your own key-value pairs with custom keys for your own usage. \n\nCustom data is available in your app's dashboard, REST API and batch export.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\\n{\\n    // Override point for customization after application launch.\\n    [Placer activateWithAppKey::::at:::\\\"APP_KEY_GOES HERE\\\"\\n              andLaunchOptions:launchOptions];\\n\\n    NSDictionary *customData = @{PLUserInfoAppUserId : @\\\"YourUserID\\\",\\n                                 PLUserInfoAge:@\\\"34\\\",\\n                                 PLUserInfoGender:@\\\"male\\\",\\n                                 PLUserInfoBirthday:@\\\"1980-12-30\\\",\\n                                 @\\\"CUSTOM_KEY_1\\\":@\\\"CUSTOM_VALUE_1\\\",\\n                                 @\\\"CUSTOM_KEY_2\\\":@\\\"CUSTOM_VALUE_2\\\"};\\n    [Placer setUserInfo:customData];\\n    return YES;\\n}\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Activating the SDK without Permissions Alerts\"\n}\n[/block]\nWhen activating the Placer SDK, new users will be presented with the location permissions dialogs. If you wish to call the dialogs yourself, activated Placer with the **andDisableLocationPermissionAlerts** set to **YES**:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"        [Placer activateWithAppKey: @\\\"YOUR_APP_KEY\\\"\\n                     launchOptions:launchOptions\\nandDisableLocationPermissionAlerts:YES];\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Note\",\n  \"body\": \"Placer will not track the device's location until the app was granted with the relevant permissions. Please see [Apple's documentation](https://developer.apple.com/documentation/corelocation/requesting_permission_to_use_location_services?language=objc) for further details.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Enable interactive mode\"\n}\n[/block]\nInteractive mode generates real-time, ad-hoc, venue detection of the current user location, whenever the app enters the foreground. Recommended for apps that requires real time user location tracking during app engagement. Activate it using the following method:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[Placer setInteractive:YES];\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Enable transit tracking\"\n}\n[/block]\nEnabled by default and detects user transits between visits. Recommended for apps that require user timeline/journal. Deactivate it using the following method:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[Placer setTransitCollection:NO];\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Enable flight tracking\"\n}\n[/block]\nFlight tracking is used to track flights in real-time. Enable flight tracking after activating Placer's SDK using the setFlightsTracking  function:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[Placer setFlightTracking:YES];\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Disable beacon support\"\n}\n[/block]\nBeacons are used to improve tracking and do **not** require additional user permissions. Therefore, beacons are enabled by default.\nDisabling beacons, which is not advised, is done as follows: \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[Placer setBeaconsSupport:NO];\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Deactivate the SDK\"\n}\n[/block]\nDeactivating the SDK is done by calling the “deactivate” function:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[Placer deactivate];\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Limit the number of beacon slots used\"\n}\n[/block]\nBy default, Placer will use all beacon slots to generate an accurate user timeline. Use the following method if you would like to limit the number of slots Placer uses (e.g. to save slots for additional location logic/use cases).\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[Placer setMaxBeaconsSlots:12]; //Replace '12' with the max number of slots Placer should use.\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"customization","type":"basic","title":"Customization"}
[block:callout] { "type": "info", "title": "Activate the SDK", "body": "Please follow our [Quick Start iOS guide](doc:ios) for SDK activation instructions." } [/block] [block:api-header] { "type": "basic", "title": "Add custom data to User Info" } [/block] If known, it is highly recommended to set the user age and gender using the PLUserInfo constants (PLUserInfoGender, PLUserInfoBirthday, PLUserInfoAge, etc.). These data will be used to improve Placer's venue detection and profiling performance. You may set your own key-value pairs with custom keys for your own usage. Custom data is available in your app's dashboard, REST API and batch export. [block:code] { "codes": [ { "code": "- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\n{\n // Override point for customization after application launch.\n [Placer activateWithAppKey:@\"APP_KEY_GOES HERE\"\n andLaunchOptions:launchOptions];\n\n NSDictionary *customData = @{PLUserInfoAppUserId : @\"YourUserID\",\n PLUserInfoAge:@\"34\",\n PLUserInfoGender:@\"male\",\n PLUserInfoBirthday:@\"1980-12-30\",\n @\"CUSTOM_KEY_1\":@\"CUSTOM_VALUE_1\",\n @\"CUSTOM_KEY_2\":@\"CUSTOM_VALUE_2\"};\n [Placer setUserInfo:customData];\n return YES;\n}", "language": "objectivec" } ] } [/block] [block:api-header] { "title": "Activating the SDK without Permissions Alerts" } [/block] When activating the Placer SDK, new users will be presented with the location permissions dialogs. If you wish to call the dialogs yourself, activated Placer with the **andDisableLocationPermissionAlerts** set to **YES**: [block:code] { "codes": [ { "code": " [Placer activateWithAppKey: @\"YOUR_APP_KEY\"\n launchOptions:launchOptions\nandDisableLocationPermissionAlerts:YES];", "language": "objectivec" } ] } [/block] [block:callout] { "type": "warning", "title": "Note", "body": "Placer will not track the device's location until the app was granted with the relevant permissions. Please see [Apple's documentation](https://developer.apple.com/documentation/corelocation/requesting_permission_to_use_location_services?language=objc) for further details." } [/block] [block:api-header] { "type": "basic", "title": "Enable interactive mode" } [/block] Interactive mode generates real-time, ad-hoc, venue detection of the current user location, whenever the app enters the foreground. Recommended for apps that requires real time user location tracking during app engagement. Activate it using the following method: [block:code] { "codes": [ { "code": "[Placer setInteractive:YES];", "language": "objectivec" } ] } [/block] [block:api-header] { "type": "basic", "title": "Enable transit tracking" } [/block] Enabled by default and detects user transits between visits. Recommended for apps that require user timeline/journal. Deactivate it using the following method: [block:code] { "codes": [ { "code": "[Placer setTransitCollection:NO];", "language": "objectivec" } ] } [/block] [block:api-header] { "type": "basic", "title": "Enable flight tracking" } [/block] Flight tracking is used to track flights in real-time. Enable flight tracking after activating Placer's SDK using the setFlightsTracking function: [block:code] { "codes": [ { "code": "[Placer setFlightTracking:YES];", "language": "objectivec" } ] } [/block] [block:api-header] { "type": "basic", "title": "Disable beacon support" } [/block] Beacons are used to improve tracking and do **not** require additional user permissions. Therefore, beacons are enabled by default. Disabling beacons, which is not advised, is done as follows: [block:code] { "codes": [ { "code": "[Placer setBeaconsSupport:NO];", "language": "text" } ] } [/block] [block:api-header] { "type": "basic", "title": "Deactivate the SDK" } [/block] Deactivating the SDK is done by calling the “deactivate” function: [block:code] { "codes": [ { "code": "[Placer deactivate];", "language": "objectivec" } ] } [/block] [block:api-header] { "title": "Limit the number of beacon slots used" } [/block] By default, Placer will use all beacon slots to generate an accurate user timeline. Use the following method if you would like to limit the number of slots Placer uses (e.g. to save slots for additional location logic/use cases). [block:code] { "codes": [ { "code": "[Placer setMaxBeaconsSlots:12]; //Replace '12' with the max number of slots Placer should use.", "language": "objectivec" } ] } [/block]