Top
Integrate Whatfix Mobile SDK with iOS
  • 20 Nov 2024
  • 2 Minutes To Read
  • Dark
    Light
  • PDF

Integrate Whatfix Mobile SDK with iOS

  • Dark
    Light
  • PDF

Article summary

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:

your title goes here

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.

Cocoapods

Add the following line in your Podfile and do pod install

pod 'LeapCoreSDK', '~> 2.0.3'
pod 'LeapSDK', '~> 2.0.3'

Manually

Download the following frameworks:

  1. leap-ios
  2. leap-core-ios

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.

Swift Package Manager

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):

Swift

import LeapCreatorSDK


class AppDelegate:UIResponder, UIApplicaitonDelegate {
		func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
				Leap.shared.start("<YOUR_API_KEY>")
        return true
		}
}

Objective C

#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.

your title goes here
  • 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

Cocoapods

Add the following line in your Podfile and do pod install

pod 'LeapCreatorSDK', '~> 2.0.3'

Manually

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.

Swift Package Manager

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).

Swift

import LeapCreatorSDK


class AppDelegate:UIResponder, UIApplicaitonDelegate {
		func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
				LeapCreator.shared.start("<YOUR_API_KEY>")
        return true
		}
}

Objective C

   
#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.

your title goes here

Was this article helpful?


What's Next
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.