LogoLogo
Insights
  • Introduction
  • A standard integration
  • FAQ
    • FAQ
      • Integration (FAQ)
      • Detections (FAQ)
      • Data interface (FAQ)
      • Security, Privacy and Terms of Service (FAQ)
      • Journeys and Insights (FAQ)
  • SDK
    • Getting Started
      • Android Quick Start
        • 1. Android Checklist
        • 2. Including the SDK
        • 3. Configuration
          • Sample Notification
        • 4. Initialization
        • 5. Starting Detections
        • 6. SDK Status Updates
        • 7. Permissions
        • 8. What's Next
      • iOS Quick Start
        • 1. iOS Checklist
        • 2. Installation
          • Installation with CocoaPods
          • Installation with Carthage
          • Manual Installation
        • 3. Configuration
          • Using Integration Guide
          • Manual Configuration
        • 4. Usage
        • 5. Tips and Guidelines
        • 6. What's Next
      • React Native Quick Start
        • 1. React Native Checklist
        • 2. Installation
        • 3. Configuration
        • 4. Initialization
        • 5. Usage
        • 6. What's Next
    • Appendix
      • Android
        • Android 10 Update Behavior
        • Android Battery Optimization
        • External SDK Dependencies
        • Manifest Permissions
        • Notification Management
      • iOS
        • App Store Privacy Section
        • App Store Release
        • iOS 13 permission changes
        • M1 Simulator Support
        • Swift Support
      • Control Sending Data
      • Controlled Detections
        • Automatic Detections
        • Automatic Detections with Forced Trips
        • Controlled Trips Only
        • Checking Trip Status
      • Custom User Metadata
      • Detecting Vehicle Crashes
      • Migration Guide
        • Android
        • iOS
      • React Native
      • SDK Initialization
      • User Credentials
      • User Linking
      • Xamarin
    • API Reference
      • Android
        • VehicleCrashDetection
          • VehicleCrashEvent
          • VehicleCrashListener
          • CrashCallback
        • InitState
        • MetaUserLinker
        • MetaUserLinkerAsync
        • MetaUserLinkerCallback
        • OnInitCallback
          • InitIssue
        • OnSdkStatusUpdateHandler
        • OnStartFinishedHandler
        • PoiAddress
        • PoiLocation
        • PointOfInterest
        • PoiPlace
        • ResetCallback
          • ResetFailureReason
        • SdkConfig
          • Builder
        • SdkException
        • SdkStatus
          • LocationSetting
          • Quota Status
          • StartStatus
        • Sentiance
        • SubmitDetectionsCallback
        • StationaryInfo
        • Token
        • TokenResultCallback
        • Trip
          • StartTripCallback
          • StopTripCallback
          • TransportMode
          • TripTimeoutListener
          • TripType
        • TripInfo
        • TripProfile
          • HardEvent
          • TransportSegment
          • VehicleMode
        • TripProfileConfig
          • Builder
        • TripProfileListener
        • UserActivity
        • UserActivityListener
        • UserActivityType
      • iOS
        • MetaUserLinker
        • SENTSDK
          • SENTSDKStatus
          • SENTPublicDefinitions
        • SENTConfig
        • SENTTripProcessingTripProfile
          • SENTTripProcessingTransportSegment
          • SENTTripProcessingHardEvent
          • SENTTripProcessingVehicleMode
        • SENTVehicleCrashEvent
      • React Native
    • Battery Optimization
    • How To
      • Check the Location Permissions
    • Troubleshooting
      • Android
      • iOS
        • Bundle format unrecognized, invalid, or unsuitable
        • Error: Undefined symbols for architecture arm64
    • Changelog
      • Android
      • iOS
  • Important topics
    • Authentication and Authorization
    • User linking
    • PlayStore Location Access Review
    • Privacy Report & Dashboard
    • Vehicle Crash Detection
  • Library
    • Events
    • Moments
    • Segments
    • Glossary
  • Backend
    • GraphQL
    • REST API Reference
      • Error Codes (REST API)
    • Offloads
    • Data Reference
      • Data Reference A-B
      • Data Reference C-G
      • Data Reference H-L
      • Data Reference M-P
      • Data Reference Q-T
      • Data Reference U-Z
  • Data Explorer
    • Data Explorer
      • Global (EU)
      • US
      • Australia
  • Guide
    • Firehose
    • Verifying your integration
    • SDK Standard License
    • Journeys License
    • Journeys Application
    • Journeys Privacy Policy
    • Technical & Organizational Measures
Powered by GitBook
On this page
  • 1. Installation
  • 2. Configuration
  • 3. Usage
  • 4. Data Collection & SDK User Creation
  • Verifying the Integration
  1. SDK
  2. Getting Started
  3. iOS Quick Start

1. iOS Checklist

PreviousiOS Quick StartNext2. Installation

Last updated 1 year ago

This document refers to deprecated parts of the platform and has been left intact to help customers with legacy integrations. In order to access the latest platform features and documentation, please go to https://docs.sentiance.com.

Follow the step below to integrate the iOS SDK.

1. Installation

1.1 Dependency

Include the following lines in your Podfile

platform :ios, '9.0'
pod 'SENTSDK'

And run the command

pod install --repo-update

If you are using Carthage instead, __

2. Configuration

2.2 Background Modes

Ensure you turn on Background Modes and enable Location updates

If you are going to use the Step Counter feature, you will need to set the property to YES, and enable Background Fetch in the capabilities **** and add a key to the app's plist**:** BGTaskSchedulerPermittedIdentifiers with an array item com.sentiance.backgroundtask.step_counter

2.3 Permissions

Ensure you include the following permission in info.plist

NSLocationAlwaysAndWhenInUseUsageDescription
NSMotionUsageDescription (Recommended)

3. Usage

3.1 SentianceHelper.swift
3.2 Initialization & Background Collection

Insert the following line in your AppDelegate.swift file and in the didFinishLaunchingWithOptions method_._ This line ensures that the SDK is initialized and can collect data while the application is in the background.

# AppDelegate.swift

SentianceHelper.initSdk()

4. Data Collection & SDK User Creation

In order for the SDK to collect data the application would need to first "create a user" on the SDK. The "createUser" should ideally be called when the user registers, logs in.

4.2 Standard

4.1 createUser

Invoke the SentianceHelper.createUser method at the moment you are ready to start the data collection. (e.g on user login, on user registration, at a feature, etc)

note: Do not forget to Include your "linkFunction"

SentianceHelper.createUser(SentianceHelper.SDKParams(
   appId: <APP ID>,
   appSecret: <APP SECRET>,
   baseUrl: "https://api.sentiance.com",
   link: linkFunction,
   initCb: { }
))
4.2 linkFunction

This function is expected to communicate/pass the installId (fetched from the SDK) to your backend

Note: This method will receive the parameters: installId, linkSuccess, linkFailure

4.3 User linking in your backend

Create an endpoint on your backend which will communicate with the Sentiance backend and request an installId to be linked to a particular user (in your database)

4.4 linkFunction -> linkSuccess()

Upon your backend successfully performing the user linking execute the

linkSucess()

method received as a parameter to you linkFunction

Verifying the Integration

You can verify the SDK integration by reading the following statuses from the SDK

SENTSDK.sharedInstance().getInitState()

INITIALIZED

SENTSDK.sharedInstance().getSdkStatus().startStatus

STARTED

You can continue reading through the next sections to get a deeper understanding of the integration and the SDK capabilities.

For a quick start we have created helper file a couple of methods to easily get started. and place it anywhere accessible in your codebase.

Note: If you find the startStatus to be PENDING it usually implies that the user has not granted location:always permission. To know more, __

Download this file
See reference
See reference
See reference
click here
See reference
click here
registerBackgroundIdentifiers