In-App Messaging SDK for iOS – Quick Commence, LivePerson APIs
Без кейворда
The LivePerson SDK provides brands with a ordinary, yet enterprise-grade and secure in-app messaging solution. Through in-app messaging, brands will foster connections with their customers and increase app engagement and retention.
This Quick Begin will quickly get you up and running with a project powered by LivePerson. When you’re done, you’ll be able to send messages inbetween an iOS device and LiveEngage. To finish this Quick Commence, you will need a LiveEngage account. You can get the number and login information from the LivePerson account team.
Prerequisites
To use the LivePerson In-App Messaging SDK, the following are required:
- XCode 8.Trio or later
- Swift Trio.1 or later, or Objective-C
Note: For information on supported operating systems and devices, refer to System Requirements.
Step 1: Installing the SDK into your project
LiveEngage In-App Messaging SDK for iOS supports numerous methods of installations.
The SDK is also compatible with CocoaPods, a dependency manager for Swift and Objective-C Cocoa projects. CocoaPods has thousands of libraries and is used in over two million apps. It can help you scale your projects elegantly and provides a standard format for managing outer libraries.
- Install cocoapods using the following directive: $ gem install cocoapods
- Navigate to your project folder and init fresh pod using the following guideline: $ pod init
Podfile should be created under your project’s folder. To integrate Liveperson Messaging SDK into your Xcode project using CocoaPods, specify it in your Podfile: “` source ‘https://github.com/LivePersonInc/iOSPodSpecs.git’ platform :ios, ‘9.0’ use_frameworks!
target ‘ ‘ do pod ‘LPMessagingSDK’ end “`
In case you wish to upgrade to the latest SDK version and you have already run ‘pod install’, run the following instruction: $ pod update
In project settings, navigate to the Build Phases tab, and click the + button to add a Fresh Run Script Phase. Add the script below in order to loop through the frameworks embedded in the application and eliminate unused architectures (used for simulator). This step is a workaround for known iOS issue and is necessary for archiving your app before publishing it to the App Store.
Option Two: Using Libraries Copy to Xcode Project
Click here to download the SDK package.
Once downloaded, extract the ZIP file to a folder on your Mac.
Copy (Haul and Drop) all framework and bundle files into the project.
Step Two: Configure project settings to connect LiveEngage SDK
In project settings, navigate to the General tab, and add all Framework files to the Embedded Binaries section.
In the General tab, make sure that the framework files are under Embedded Libraries.
In Build settings, make sure Always Embed Swift Standard Libraries is set to YES.
- Key: NSPhotoLibraryUsageDescription, Value: "Photo Library Privacy Setting for LiveEngage In-App Messaging SDK for iOS",
- Key: NSCameraUsageDescription, Value: "Camera Privacy Setting for LiveEngage In-App Messaging SDK for iOS"
This step is required in order to be able to upload your host app into the App Store, as SDK Two.0 has the capability to share photos from the camera and/or photo library. Note: Due to Apple policy, this step is mandatory even if the photo sharing feature is disabled in the SDK.
In project settings, navigate to the Build Phases tab, and click the + button to add a Fresh Run Script Phase. Add the script below in order to loop through the frameworks embedded in the application and eliminate unused architectures (used for simulator). This step is a workaround for known iOS issue and is necessary for archiving your app before publishing it to the App Store.
If frameworks installed using CocoaPods, use the following script: bash "$/Pods/LPMessagingSDK/LPMessagingSDK/LPInfra.framework/frameworks-strip.sh"
If frameworks installed using copy to Xcode project, use the following script: bash "$/$/LPInfra.framework/frameworks-strip.sh"
Step Trio: Initialization
- Inwards AppDelegate , under didFinishLaunchingWithOptions , add the following code:
Set up and call the conversation view. You’ll need to provide your LivePerson account number and a container view controller.
let conversationQuery = LPMessagingSDK.example.getConversationBrandQuery(accountNumber)
In order to liquidate the conversation view when your container is deallocated, run the following code: