Installing the MOPRIM TMD SDK

Before you start using the MOPRIM TMD SDK in your iOS application, you will need to add the SDK as a dependency. The MOPRIM SDK also requires that you include some other dependencies into your project in order to function. If you do not have the MOPRIM TMD SDK, you can contact us to get a quote and developer API key.

Table of content

Add the MOPRIM TMD SDK dependency

  • In your Xcode project, drag the MOPRIMTmdSdk.xcframework into your target’s Frameworks, Libraries and Embedded Content section, and make sure the Embed & Sign option is set.
  • The TMD SDK relies on AWS dependencies (v2.28.5) that you can download from this link.
  • From the downloaded frameworks, you will only these ones:
- AWSAPIGateway.xcframework
- AWSCognitoIdentityProvider.xcframework
- AWSCognitoIdentityProviderASF.xcframework
- AWSCore.xcframework
- AWSS3.xcframework
  • Drag them into your target’s Frameworks, Libraries and Embedded Content section, and make sure the Embed & Sign option is set.

Embedded Frameworks

Configure your project

  • In your Info.plist, add the following keys in order to support location monitoring, motion monitoring, and background modes:
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>The apps monitors the user's mobility and requires the user's location to do so</string>

<key>NSLocationAlwaysUsageDescription</key>
<string>If the user is mobile, a significant location change will trigger the capture of the mobility data of the user</string>

<key>NSLocationUsageDescription</key>
<string>The apps monitors the user's mobility and requires the user's location to do so</string>

<key>NSLocationWhenInUseUsageDescription</key>
<string>The apps monitors the user's mobility and requires the user's location to do so</string>

<key>NSLocationTemporaryUsageDescriptionDictionary</key>
<dict>
	<key>tmd.AccurateLocationPurpose</key>
	<string>The app monitors your mobility and requires your precise location to do so</string>
</dict>

<key>NSMotionUsageDescription</key>
<string>The app collects accelerometer data to evaluate the modes of transports used by the iOS device user</string>

<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>location</string>
</array>

The strings you associate with those keys will be presented to the user to ask for permission to access location and motion data. It is important that the user allows the app to access “Precise” location “Always and when in use” for the TMD to work correctly. It is also important that the user allows access to motion data.

Please note that starting from iOS 13, when requesting to access the location “Always”, iOS first asks the user for the “WhenInUse” authorization, and later, at a time that it deems appropriate, for the “Always” authorization. Starting from iOS 13.4, it is possible, however, to first request the “WhenInUse” authorization, and then immediately request the “Always” authorization, in order to go around this limitation. The Transport Mode Detection will only work once the user allows the location to be accessed “Always”.

Please note that starting from iOS 14, iOS allows the user to give access to only “Approximate” location. The Transport Mode Detection will only work once the user allows the “Precise” location to be accessed.

Next

Using the MOPRIM TMD SDK