Integrate Whatfix Mobile SDK with MAUI (iOS)

Prev Next

To create Whatfix Mobile in-app experiences on iOS apps built using MAUI (Multi-platform App UI), you need to first set up Whatfix Mobile.

Pre-requisite

In some cases, MAUI applications require tagging specific elements with an AutomationId for precise screen element identification. This approach is also recommended for automation testing in MAUI applications.

Use the following code snippet for tagging iOS MAUI views:

<Button x:Name="randomizeButton"
        Text="Randomize"
        AutomationId="randomize_button_id"
        Clicked="OnRandomizeButtonClicked"
        HorizontalOptions="Center"
        VerticalOptions="Center" />

Integration steps for MAUI iOS

Use the following steps to integrate the Whatfix Mobile SDK in your MAUI iOS project:

Info

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 MAUI SDK dependency

Add the Whatfix Mobile MAUI Library package from nuget.

Add the LeapSDK.Maui.iOS package from nuget to the Packages in your iOS specific project using the following command:

dotnet add package LeapSDK.Maui.iOS --version 2.0.9

b. Start the Whatfix Mobile SDK

Start the Whatfix Mobile SDK using the following code snippet:

namespace MyMauiApp;

        #if IOS
        using LeapSDK;
        #endif


        public partial class MainPage : ContentPage
        {

        public MainPage()
        {
        #if IOS
        Leap.Shared.Start("<API_KEY>");
        #endif
        }
        }

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.

a. Add dependencies

Info:

  • The Whatfix Mobile Creator Plugin must be removed before the app goes live on the Play 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.

Add the Whatfix Mobile MAUI Creator package from nuget.

Add LeapCreatorSDK.Maui.iOS package from nuget to the Packages in your iOS specific project using the following command:

dotnet add package LeapCreatorSDK.Maui.iOS --version 2.0.9

b. Start the Whatfix Mobile Creator SDK

Start the Whatfix Mobile Creator SDK using the following code snippet:

namespace MyMauiApp;

        #if IOS
        using LeapCreatorSDK;
        #endif


        public partial class MainPage : ContentPage
        {

        public MainPage()
        {
        #if IOS
        LeapCreator.Shared.Start("<API_KEY>");
        #endif
        }
        }

After integrating the code, you can start creating your in-app experience using Whatfix Mobile.