- 20 Nov 2024
- 1 Minute zum Lesen
-
Drucken
-
DunkelLicht
-
pdf
Integrate Whatfix Mobile SDK with Cordova iOS
- Aktualisiert am 20 Nov 2024
- 1 Minute zum Lesen
-
Drucken
-
DunkelLicht
-
pdf
To create Whatfix Mobile in-app experiences on your Cordova iOS apps, you need to first set up Whatfix Mobile. You can add the Whatfix Mobile SDK provided for Cordova iOS apps to the source code of your app and then create and publish content.
Integration steps for Cordova iOS app
Use the following steps to integrate the Whatfix Mobile SDK in your Cordova iOS project:
Ensure that you complete both the steps, to create and test the in-app experience in your integrated build.
Step 1: Integrate Whatfix Mobile plugin
a. Add the Whatfix Mobile dependency
Download the Whatfix Mobile Cordova Plugin package from npm using the following command:
cordova plugin add leap-cordova-ios@2.0.3
cd platforms/ios && pod install
// To update Leap iOS Plugin once installed, run the following command
pod update
b. Start the Whatfix Mobile SDK
To start Whatfix Mobile, add the following code inside onDeviceReady() {}.
document.addEventListener('deviceready', onDeviceReady, false);
function onDeviceReady() {
if(device.platform === 'iOS') {
cordova.plugins.LeapiOS.start("<YOUR_API_KEY>");
}
}
Step 2: Enable Creator mode in your app
To create in-app experiences in the Whatfix Mobile Studio, you have to enable the Creator mode in your app. This is done by integrating the Whatfix Mobile Creator Plugin.
a. Add dependencies
- The Whatfix Mobile Creator SDK must be removed before the app goes live on the App Store.
- While both Whatfix Mobile Creator SDK and Whatfix Mobile SDK need to be integrated in the development and testing versions, the production version should only have the Whatfix Mobile SDK.
Download the Whatfix Mobile Creator Cordova Plugin package from npm using the following command:
cordova plugin add leap-cordova-creator-ios@2.0.3
cd platforms/ios && pod install
// To update Leap creator iOS Plugin once installed, run the following command
pod update
b. Start the Whatfix Mobile Creator Plugin
To start the Whatfix Mobile creator, add the following code inside onDeviceReady() {} .
document.addEventListener('deviceready', onDeviceReady, false);
function onDeviceReady() {
if(device.platform === 'iOS') {
cordova.plugins.LeapCreatoriOS.start("<YOUR_API_KEY>");
}
}
After integrating the code, you can start creating your in-app experience using Whatfix Mobile.