Install the iOS SDK

To get started, install the SDK and then update some of the properties in your project.

Install the Frameworks 

You can install the SDK using Swift Package Manager, CocoaPods, or you can download and install the frameworks manually.

OPTION 1: Install with Swift Package Manager 

To add the frameworks using Swift Package Manager, add a package dependency to your app using this public URL: https://github.com/Salesforce-Async-Messaging/Swift-Package-InAppMessaging.

To learn more about package dependencies, see Adding Package Dependencies to Your App in Apple’s Developer Documentation.

OPTION 2: Install with CocoaPods 

If you haven’t already done so, install the CocoaPods gem, and initialize the CocoaPods main repository.

Install cocoapods
1sudo gem install cocoapods
2pod setup

If you already have CocoaPods installed, update your pods to the latest version.

Update cocoapods
1pod update

To create a Podfile, change to the root directory of your application project. Then create or edit the file named Podfile.

Create podfile
1platform :ios, '14.0'
2
3target 'MyApp' do
4  use_frameworks!
5
6  # Pod for Enhanced In-App Chat UI and Core SDK
7  pod 'Messaging-InApp-UI'
8end

If you plan to use the Core SDK (and not the UI SDK), use the following pod instead of Messaging-InApp-UI: Messaging-InApp-Core.

Note

Run the CocoaPods installer. If you’re adding a new pod to your project, use this command:

Run installer
1pod install

If you’re updating your pod to a newer version, use this command:

Update pod
1pod update

Open the .xcworkspace file that CocoaPods generated to use the SDK in your app.

OPTION 3: Install Frameworks Manually 

To install the XCFramework files manually, get the framework files (SMIClientUI, SMIClientCore) from the release notes page and embed them into your project. If you aren’t using our UI SDK, you don’t need to embed the SMIClientUI framework file.

Update Your Info Properties 

Several features of the SDK require you to add values to your project’s information property list (Info.plist).

Camera and Photos 

Add descriptions for why the app wants to access the device’s camera and photo library. This functionality is necessary when a customer attempts to send an image attachment to a rep.

Add string values for “Privacy - Camera Usage Description” (NSCameraUsageDescription) and “Privacy - Photo Library Usage Description” (NSPhotoLibraryUsageDescription) in your project’s Info properties (Info.plist file).

For example:

Enable camera and photos
1<key>NSCameraUsageDescription</key>
2<string>Used when sending an image to a rep.</string>
3
4<key>NSPhotoLibraryUsageDescription</key>
5<string>Used when sending an image to a rep.</string>

Access to Files 

Allow the app to access files on the device so that a customer can share a file with the rep. Set “Supports opening documents in place” (LSSupportsOpeningDocumentsInPlace) and “Application supports iTunes file sharing” (UIFileSharingEnabled) to “YES”.

Enable access to files
1​​<key>LSSupportsOpeningDocumentsInPlace</key>
2<true/>
3<key>UIFileSharingEnabled</key>
4<true/>

Notifications 

If you want to take advantage of push notifications for messaging events, make sure that your app supports the “Push Notifications” capability from your project’s Capabilities settings.