Show the Introduction Screen
The SDK displays the introduction screen during the very first app launch, considering this the trigger. This feature enables you to add extra triggers and also allows you to disable the default app launch trigger.
For instance, you may choose to present the introduction screen at the end of your onboarding screens or provide an option to show it again from a help menu.
Select a Trigger and Show the Introduction Screen
Select a Trigger
Decide from where you want to show the introduction screen. For example, at the end of your onboarding screens or when a button in a menu is pressed. We will call this the trigger. This simple example shows a possible trigger - when a button is pressed in a SwiftUI app.
Show the Introduction Screen from the Trigger
Place an import statement to import the SDK at the top of the file containing the trigger (the event which will trigger the display of the introduction screen). For example, this might be a View Controller, or a View.
Call showIntroductionUI
(Swift), or showIntroductionUIWithDisplayOnlyOnce:error:
(Objective-C), at the moment you want to show the introduction screen inside the trigger, handling any errors thrown:
The above examples will display the introduction screen each time the function containing the showIntroductionUI:
or showIntroductionUIWithDisplayOnlyOnce:error
method is called. If you only want to show the introduction screen the first time the function is called, set displayOnlyOnce
to true
.
The only error the SDK throws is the FlightRecorderSDKError.failedToStart
error. To effectively handle this error, consider logging it directly to the console, or alternatively, utilize your preferred logging framework.
If you do encounter the FlightRecorderSDKError.failedToStart
error, it indicates that the triggerCaptureRecording
function was called before initializing the FlightRecorderSDK
with the start
function.
To resolve this issue, ensure that you call FlightRecorderSDK.start
during your application's initialization phase as shown in the SDK Configuration section, before invoking any further functions.
Here is the completed SwiftUI example, completed by calling the method from the onButtonClick function:
Prevent the Introduction Screen from Showing on First Launch
If you do not wish to show the introduction screen when you first launch the app, follow the instructions for your language and framework.
SwiftUI
Navigate to the main entry point of your application, which is annotated with
@main
and contains yourApp
instance. Locate the code that starts the SDK by searching for
FlightRecorderSDK.start
.Set
automaticallyShowIntroduction: false
when starting the SDK as shown:SwiftSave your changes. The introduction UI will no longer show on first launch.
UIKit with Scenes
Navigate to the SceneDelegate file within your project.
Locate the code that starts the SDK by searching for
FlightRecorderSDK.start
.Set
automaticallyShowIntroduction: false
when starting the SDK as shown:SwiftObjective-CSave your changes. The introduction UI will no longer show on first launch.
UIKit without Scenes
Navigate to the AppDelegate file within your project.
In the
applicationDidBecomeActive(_:)
method, locate and delete the following lines depending on the language you are using:SwiftObjective-CSave your changes. The introduction UI will no longer show on first launch.
Last updated