Skip to content

Quick Start

This document provides the shortest path to integrate the iOS RUM SDK, helping you complete a verifiable data report with minimal steps.

Prerequisites

Before starting, please complete the following preparations:

  1. Create an iOS application in RUM and obtain the RUM App ID.
  2. Confirm the reporting address and authentication method:
  3. Local environment deployment: Prepare datakitUrl.
  4. Public DataWay: Prepare datawayUrl and clientToken.
  5. Confirm that the project has completed SDK installation, supporting CocoaPods, Carthage, or Swift Package Manager.

Integration Steps

  1. Install FTMobileSDK in the project.
  2. Initialize FTMobileConfig when the application launches.
  3. Initialize FTRumConfig and enable View, Action, Resource, crash, and freeze collection.
  4. Enable debug logs, run the application, and trigger a page view or network request.
  5. Confirm in the console and the Guance platform that the data has been successfully reported.

Install SDK

For installation methods, please refer directly to Application Access.

If you only want to quickly verify, it is recommended to use CocoaPods or Swift Package Manager first.

Minimal Initialization Example

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // For local environment deployment, use [[FTMobileConfig alloc] initWithDatakitUrl:datakitUrl]
    FTMobileConfig *config = [[FTMobileConfig alloc] initWithDatawayUrl:datawayUrl clientToken:clientToken];
    config.enableSDKDebugLog = YES;
    [FTMobileAgent startWithConfigOptions:config];

    FTRumConfig *rumConfig = [[FTRumConfig alloc] initWithAppid:appid];
    rumConfig.enableTraceUserView = YES;
    rumConfig.enableTraceUserAction = YES;
    rumConfig.enableTraceUserResource = YES;
    rumConfig.enableTrackAppFreeze = YES;
    rumConfig.enableTrackAppCrash = YES;
    rumConfig.enableTrackAppANR = YES;
    [[FTMobileAgent sharedInstance] startRumWithConfigOptions:rumConfig];
    return YES;
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // For local environment deployment, use FTMobileConfig(datakitUrl: datakitUrl)
    let config = FTMobileConfig(datawayUrl: datawayUrl, clientToken: clientToken)
    config.enableSDKDebugLog = true
    FTMobileAgent.start(withConfigOptions: config)

    let rumConfig = FTRumConfig(appid: appid)
    rumConfig.enableTraceUserView = true
    rumConfig.enableTraceUserAction = true
    rumConfig.enableTraceUserResource = true
    rumConfig.enableTrackAppFreeze = true
    rumConfig.enableTrackAppCrash = true
    rumConfig.enableTrackAppANR = true
    FTMobileAgent.sharedInstance().startRum(withConfigOptions: rumConfig)
    return true
}

The above example meets the minimum RUM integration and enables crash and freeze detection by default. If using local environment deployment, replace initWithDatawayUrl:clientToken: / FTMobileConfig(datawayUrl:clientToken:) with initWithDatakitUrl: / FTMobileConfig(datakitUrl:).

Optional: Initialize Log and Trace

If you also need log collection or APM, you can add the following initialization:

FTLoggerConfig *loggerConfig = [[FTLoggerConfig alloc] init];
loggerConfig.enableCustomLog = YES;
loggerConfig.enableLinkRumData = YES;
[[FTMobileAgent sharedInstance] startLoggerWithConfigOptions:loggerConfig];

FTTraceConfig *traceConfig = [[FTTraceConfig alloc] init];
traceConfig.enableAutoTrace = YES;
traceConfig.enableLinkRumData = YES;
[[FTMobileAgent sharedInstance] startTraceWithConfigOptions:traceConfig];
let loggerConfig = FTLoggerConfig()
loggerConfig.enableCustomLog = true
loggerConfig.enableLinkRumData = true
FTMobileAgent.sharedInstance().startLogger(withConfigOptions: loggerConfig)

let traceConfig = FTTraceConfig()
traceConfig.enableAutoTrace = true
traceConfig.enableLinkRumData = true
FTMobileAgent.sharedInstance().startTrace(withConfigOptions: traceConfig)

Verify Integration Success

  1. Keep enableSDKDebugLog = YES/true enabled and run the application.
  2. Open a page or initiate a URLSession network request.
  3. Confirm in the Xcode console that logs related to SDK initialization and data synchronization appear.
  4. Return to the Guance console and confirm that corresponding RUM data appears in the application.

If further troubleshooting is needed, please refer to Troubleshooting.

Next Steps