Install the iOS SDK

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

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.

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

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

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.

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

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

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.

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 an agent.

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:

Access to Files

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

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.