For native integration, simply follow the steps outlined under the installation and configuration section to quickly integrate the SDK into your app.
Install the following:
Xcode 14.0 or later
CocoaPods 1.10.0 or later
Make sure that your project meets these requirements:
Set up a physical iOS device or use the iOS simulator to run your app.
Note:
We recommend using CocoaPods to install the Thunderhead SDK. However, if you'd rather not use CocoaPods, you can integrate the SDK framework directly or use Swift Package Manager instead.
For integration via Cocoapods, please follow Cocoapods Integration Guide.
For integration via Swift Package Manager, please follow SPM Integration Guide.
For manual integration, please follow Manual Integration Guide.
The SDK supports biometric authentication (Touch ID / Face ID) in Admin mode
Note:
<key>NSFaceIDUsageDescription</key>
<string>Why is my app authenticating using face id?</string>
to your Info.plist
file. Failure to do so results in a dialog that tells the user your app has not provided the Face ID usage description.
Enable your app to automatically recognize Interactions in your app, by executing the following steps:
Complete the following steps to initialize the SDK.
Swift:
```swift
import Thunderhead
```
Objective-C:
```objective-c
@import Thunderhead;
```
To start tracking, capturing, and receiving Optimizations with the Thunderhead SDK in User mode, you must first initialize it with your Thunderhead API parameters. You can find your Thunderhead API parameters on the API Credentials page in Thunderhead ONE or Salesforce Interaction Studio.
For more information on finding these parameters:
With your parameters ready at hand, add the following lines to the top of the didFinishLaunchingWithOptions
:
Swift:
One.startSessionWithSK("ONE-XXXXXXXXXX-1022",
uri:"myAppsNameURI",
apiKey:"f713d44a-8af0-4e79-ba7e-xxxxxxxxxxxxxxxx",
sharedSecret:"bb8bacb2-ffc2-4c52-aaf4-xxxxxxxxxxxxxxxx",
userId:"[email protected]", // For Interaction Studio integrations use a numeric user id - see https://permalink.thunderhead.com/mobile-docs/is-mobile-integration-info-credentials
adminMode:false,
hostName:"eu2.thunderhead.com")
Objective-C:
[One startSessionWithSK:@"ONE-XXXXXXXXXX-1022"
uri:@"myAppsNameURI"
apiKey:@"f713d44a-8af0-4e79-ba7e-xxxxxxxxxxxxxxxx"
sharedSecret:@"bb8bacb2-ffc2-4c52-aaf4-xxxxxxxxxxxxxxxx"
userId:@"[email protected]" // For Interaction Studio integrations use a numeric user id - see https://permalink.thunderhead.com/mobile-docs/is-mobile-integration-info-credentials
adminMode:NO
hostName:@"eu2.thunderhead.com"];
We recommend adding the Admin mode function on your internal builds, behind a debug settings function or on a dedicated build pipeline, as described here.
To use the framework in Admin mode, simply change the adminMode
boolean to true
, as follows:
Swift:
One.startSessionWithSK("ONE-XXXXXXXXXX-1022",
uri:"myAppsNameURI",
apiKey:"f713d44a-8af0-4e79-ba7e-xxxxxxxxxxxxxxxx",
sharedSecret:"bb8bacb2-ffc2-4c52-aaf4-xxxxxxxxxxxxxxxx",
userId:"[email protected]", // For Interaction Studio integrations use a numeric user id - see https://permalink.thunderhead.com/mobile-docs/is-mobile-integration-info-credentials
adminMode:true,
hostName:"eu2.thunderhead.com")
Objective-C:
[One startSessionWithSK:@"ONE-XXXXXXXXXX-1022"
uri:@"myAppsNameURI"
apiKey:@"f713d44a-8af0-4e79-ba7e-xxxxxxxxxxxxxxxx"
sharedSecret:@"bb8bacb2-ffc2-4c52-aaf4-xxxxxxxxxxxxxxxx"
userId:@"[email protected]" // For Interaction Studio integrations use a numeric user id - see https://permalink.thunderhead.com/mobile-docs/is-mobile-integration-info-credentials
adminMode:YES
hostName:@"eu2.thunderhead.com"];
Note:
You have now successfully integrated the codeless Thunderhead SDK for iOS.
When integrating with Salesforce Interaction Studio you can set the Admin mode theme to match the Interaction Studio look and feel, as follows:
Swift:
One.setTheme(OneTheme.InteractionStudio)
Objective-C:
[One setTheme:OneThemeInteractionStudio];
Note:
ViewController
/View
lifecycle overriding rulesThe framework listens to a number of UIViewController
and UIView
methods to provide the desired functionality. Those methods are:
viewWillAppear
viewDidAppear
viewWillDisappear
didMoveToWindow
If you use these methods in your code, please ensure to call super when implementing them.
In order to reduce the number of unnecessary Interaction requests sent automatically by the SDK, only codeless Interactions with explicit Interaction paths created under a Touchpoint and configured with at least one point are sent to Thunderhead ONE or Salesforce Interaction Studio. This configuration change has been introduced in version 5.3.0 of the iOS SDK.
Note:
For additional features of Thunderhead SDK, please follow Additional Features Guide.
Having trouble with Thunderhead and your iOS project? Visit the Troubleshooting Guide
For Salesforce Marketing Cloud Interaction Studio questions, please submit a support ticket via https://help.salesforce.com/home.
For Thunderhead ONE questions, please submit a support ticket via https://support.thunderhead.com.
link |
Stars: 7 |
Last commit: 2 weeks ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics