- 20 Nov 2024
- 2 Minutes To Read
-
Print
-
DarkLight
-
PDF
Integrate Whatfix Mobile SDK with iOS
- Updated On 20 Nov 2024
- 2 Minutes To Read
-
Print
-
DarkLight
-
PDF
To create Whatfix Mobile in-app experiences on your iOS apps, you need to first set up Whatfix Mobile. You can add the Whatfix Mobile SDK provided for iOS devices to the source code of your app and then create and publish content.
Prerequisites
- API Key
- The minimum deployment target of the Whatfix Mobile SDK is iOS 10. But, Whatfix Mobile works only for devices running on iOS 11 and above.
- To identify views accurately, you have to tag views.
- Xcode
Integration steps for iOS
Use the following steps to integrate the Whatfix Mobile SDK with your 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 SDK
a. Add the Whatfix Mobile SDK as a library from dependency managers suitable to your project.
Add the following line in your Podfile and do pod install
pod 'LeapCoreSDK', '~> 2.0.3'
pod 'LeapSDK', '~> 2.0.3'
Download the following frameworks:
Add both of these frameworks to your app target's Frameworks, Libraries and, Embedded Content. You also need to add GzipSwift as a swift package to the app target.
For more information, see leap-ios.
b. Start the Whatfix Mobile SDK
Call the following method to start the Whatfix Mobile SDK (Preferably in the application(_:didFinishLaunchingWithOptions:) method in the AppDelegateclass):
import LeapCreatorSDK
class AppDelegate:UIResponder, UIApplicaitonDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
Leap.shared.start("<YOUR_API_KEY>")
return true
}
}
#import <LeapSDK/LeapSDK-Swift.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[Leap shared] start:@"<YOUR_API_KEY>"];
return YES;
}
@end
Step 2: Enable the 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 SDK.
- 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.
a. Add LeapCreatorSDK as a library from dependency managers suitable to your project
Add the following line in your Podfile and do pod install
pod 'LeapCreatorSDK', '~> 2.0.3'
Download the Leap Creator framework. Add the framework to your app target's Frameworks, Libraries And Embedded Content. You also need to add the Starscream WebSocket as a swift package to the app target.
https://github.com/Leap-Platform/leap-creator-ios
b. Start the Whatfix Mobile Creator SDK
Call the following method to start the Whatfix Mobile SDK. (Preferably in the application(_:didFinishLaunchingWithOptions:) method in AppDelegate class).
import LeapCreatorSDK
class AppDelegate:UIResponder, UIApplicaitonDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
LeapCreator.shared.start("<YOUR_API_KEY>")
return true
}
}
#import <LeapCreatorSDK/LeapCreatorSDK-Swift.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[LeapCreator shared] start:@"<YOUR_API_KEY>"];
return YES;
}
@end
After integrating the code, you can start creating your in-app experience using Whatfix Mobile.
- For more information on setting up Whatfix Mobile calls, see Setup Whatfix Mobile Callbacks.
- For more information on segmentation, see Add Custom Properties to User Segments.