Objective-C without Scenes

If your application is written in Objective-C and does not use Scenes, having an AppDelegate file, follow these steps: ​

  1. Open the AppDelegate.m file and add the #import <PulseLabsFlightRecorderSDK/PulseLabsFlightRecorderSDK-Swift.h> statement to the top of the file:

    AppDelegate.m
    #import "AppDelegate.h"
    
    // Insert the import statement:
    #import <PulseLabsFlightRecorderSDK/PulseLabsFlightRecorderSDK-Swift.h>
    
    @implementation AppDelegate

  2. Insert [FlightRecorderSDK startWithApiKey:@"YOUR_API_KEY" automaticallyShowIntroduction:FALSE]; into the application:didFinishLaunchingWithOptions method as shown below, replacing the text "YOUR_API_KEY" with your own API key. There is also one optional parameter called "surveyName" that takes in a string. If you have designed an in-app survey on the portal, then supply the unique survey name string here, and it will show that instead of the default form

    AppDelegate.m
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
        // Insert here:
        [FlightRecorderSDK startWithApiKey:@"YOUR_API_KEY" automaticallyShowIntroduction:FALSE surveyName: "SURVEY_NAME"?];
        
        return YES;
    }
  3. Add the applicationDidBecomeActive: delegate method if it doesn't already exist, and then insert the code to safely call the showIntroductionUIWithDisplayOnlyOnce:true error: method as shown below. This will show the Introduction Screen on the first time application launch:

    AppDelegate.m
    - (void)applicationDidBecomeActive:(UIApplication *)application
    {
        // Insert here:
        NSError *error = nil;
        [FlightRecorderSDK showIntroductionUIWithDisplayOnlyOnce:true error:&error];
        if (error) {
            NSLog(@"Error: %s", "FlightRecorderSDK not yet started, cannot show introduction screen.");
        }
    
    }

    Note: The error handling is present in case you accidentally run the showIntroductionUIWithDisplayOnlyOnce:error: before the startWithApiKey:automaticallyShowIntroduction method. If you do this, the introduction screen will not appear but you will have an error in your logs.

The SDK is now installed! You can shake or take a screenshot on a real device (the SDK will not work in a simulator) to capture the video content and send a report.

If you have any issues, head to the Troubleshooting section.

Last updated