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:
- Create an iOS application in RUM and obtain the
RUM App ID. - Confirm the reporting address and authentication method:
- Local environment deployment: Prepare
datakitUrl. - Public DataWay: Prepare
datawayUrlandclientToken. - Confirm that the project has completed SDK installation, supporting
CocoaPods,Carthage, orSwift Package Manager.
Integration Steps¶
- Install
FTMobileSDKin the project. - Initialize
FTMobileConfigwhen the application launches. - Initialize
FTRumConfigand enable View, Action, Resource, crash, and freeze collection. - Enable debug logs, run the application, and trigger a page view or network request.
- 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:)withinitWithDatakitUrl:/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¶
- Keep
enableSDKDebugLog = YES/trueenabled and run the application. - Open a page or initiate a
URLSessionnetwork request. - Confirm in the Xcode console that logs related to SDK initialization and data synchronization appear.
- 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¶
- For complete installation and initialization instructions, continue reading Application Access.
- For explanations of all initialization parameters, read SDK Initialization.
- For detailed configurations of RUM, Log, and Trace, read RUM Configuration, Log Configuration, Trace Configuration.
- If you need to integrate WebView monitoring, read WebView Data Monitoring.
- If you need to integrate Session Replay, read iOS Session Replay.