The minimum iOS version required is 15.0
Xcode 16.1 and above
Supported Swift versions 4.2, 5.0, 6.0
The SDK is available on the Swift Package Manager. To link the SDK to your app, simply follow steps below
1: Open your project in Xcode.
2: Go to File > Add Packages.
3: Paste the SDK’s GitHub URL -> https://github.com/surveyanalyticscorp/ios-cx.
4: Select Dependancy Rule -> Exact Version which is 2.3.3
5: Click Add Package.
6: Once downloaded, XCode will ask you to link this package to your app, select the appropriate target and click Add Package.
1: Open your project in Xcode.
2: Add the below pod entry into podfile -
pod 'QuestionProCXFramework', :git => 'https://github.com/surveyanalyticscorp/ios-cx'
3: Run pod install command in ios directory. (Verify the latest version 2.3.3)
The SDK initialisation should be done in the AppDelegate or SceneDelegate of the application. To configure the
QuestionPro SDK into your application, use the code below.
Import QuestionProCXFramework into your application’s AppDelegate or SceneDelegate.
let touchPoint = touchPoint.initTouchPoint(TouchPoint.DataCenter.DATA_CENTER_US);
QuestionProCXFramework.configure(
apiKey: apiKey,
touchPoint: touchPoint,
withWindow: window,
callbackDelegate: self);
Extend the callback delegate named 'QuestionProDelegate' and implement the below callback functions:
func initSDKSuccess(){
// SDK successfully initialized
}
func initSDKFailed(error: any Error){
//Return the error if the SDK failed to initialize
}
func onError(errorMessage: String){
//Return the error if the SDK failed to initialize
}
The 'View Count' rule, found in the 'Rules set-up' section of the admin dashboard, allows administrators to control when an intercept is displayed to users based on their mobile application navigation. This rule uses two parameters: screen_name to specify the screen(s) to monitor, and count to set the view threshold before the intercept is triggered.
Set up the rule:
- Select the rule ‘view count’ from the mobile intercept settings.
- Set ‘screen name’ for example ‘checkout_screen’.
- Set the count (After how many events you want to launch the survey)
Configure it in the mobile application:
Add the below line of code to the app where you have to record the count. SDK will log and maintain the count and launch the survey once it satisfies the rule setup for the intercept.
import QuestionProCXFramework
QuestionProCX.getinstance().setScreenName(screenName: "SecondScreen")
The Mobile Intercept SDK leverages Custom Variables to enrich the context and user details associated with an intercept.
How to Set Data Mapping for an Intercept:
- Navigate to the intercept for which you want to configure data mapping.
- Click on the Add button to begin setting up the data mapping.
How to Set Data Mapping in SDK:
let customVariables = ["firstName: "First Name",
"surname": "Last Name",
"emailAddress", "+918977234"]
QuestionProCX.getinstance().setDataMappings(dataMappings:customVariables)
If you set up the Intercept interaction type to the ‘Survey URL’, then this callback function will return the
URL of the survey instead of launching the survey. The consumer app will use this survey URL as per their requirement
in any ViewController.
import UIKit
import QuestionProCXFramework
class ViewController: UIViewController, QuestionProCallbackDelegate {
func getSurveyURL(surveyURL: String) {
print("launch survey URL inside ViewController: \(surveyURL)")
}
override func viewDidLoad() {
super.viewDidLoad()
QuestionProCX.getinstance()
.setQuestionProCallbackDelegate(questionProCallbackDelegate: self)
}
}
If you want to close the survey window/screen programmatically before completing the survey, you can use the following
import QuestionProCXFramework
QuestionProCX.getinstance().closeSurveyWindow();