Skip to main content
Flashduty iOS RUM SDK supports iOS 12.0, iPadOS 12.0, tvOS 12.0 and above. By integrating the SDK, you can monitor your iOS app’s performance, errors, and user behavior in real-time.
About Dependencies and Package NamesFlashduty iOS SDK is fully compatible with the Datadog open-source protocol. When adding dependencies through Swift Package Manager or CocoaPods, use names like FlashcatCore, FlashcatRUM, and FlashcatTrace, but in code, import modules like DatadogCore, DatadogRUM, and DatadogTrace. You can reuse documentation, examples, and best practices from the Datadog ecosystem with the Flashduty platform.

Integration steps

1

Add SDK Dependencies

Flashduty iOS SDK supports Swift Package Manager and CocoaPods:
  1. In Xcode, open your project and select File → Add Package Dependencies
  2. Enter the Flashduty SDK Git repository URL:
  3. Select version rule:
    • Recommended: Select Up to Next Major Version and enter the latest version number (for example, 0.9.1)
    • This allows bug fixes and minor updates while maintaining compatibility
  4. Click Add Package and wait for Xcode to download dependencies
  5. In the Choose Package Products window, select modules to add to your Target:
    • FlashcatCore - Core SDK (required)
    • FlashcatRUM - RUM feature module (required)
    • FlashcatTrace - Trace feature module (required when enabling the Trace feature, automatic Trace spans, or manual spans)
    • FlashcatWebViewTracking - WebView tracking (optional)
    • FlashcatCrashReporting - Crash reporting (recommended)
  6. Ensure each module is linked to the correct Target, click Add Package to complete
Get Latest VersionCheck the SDK Release Page for the latest stable version. Pin to a specific version to avoid unexpected updates.
2

Get Application Credentials

In the Flashduty console’s RUM Application Management page:
  1. Create or select an iOS application
  2. Get the following credentials:
    • Application ID - Application unique identifier
    • Client Token - Client access token
3

Initialize SDK

Initialize the SDK in your AppDelegate.swift’s application(_:didFinishLaunchingWithOptions:) method:
AppDelegate.swift
Parameter Description:
  • clientToken - Client token obtained from console (required)
  • env - Environment name, for example, production, staging (required)
  • trackingConsent - User tracking consent state (see below)
TrackingConsent States:
You can dynamically modify tracking consent state after initialization through Datadog.set(trackingConsent:).
4

Enable RUM Features

Configure and enable RUM features. Recommend enabling early in AppDelegate:
AppDelegate.swift
Configuration Parameter Description:
  • applicationID - RUM application ID obtained from console
  • uiKitViewsPredicate - UIKit view tracking strategy
  • uiKitActionsPredicate - UIKit user action tracking strategy
  • swiftUIViewsPredicate - SwiftUI view tracking strategy
  • swiftUIActionsPredicate - SwiftUI user action tracking strategy
  • urlSessionTracking - URLSession network request tracking configuration
The SDK will automatically start collecting the following data:
  • UIKit and SwiftUI view tracking
  • User interaction events
  • Network request monitoring
5

Configure Network Tracking (Optional)

Configure first-party hosts and trace correlation:To correlate mobile RUM Resources with backend traces, configure firstPartyHostsTracing in RUM.Configuration for your first-party hosts. Hosts must be host names only, without http://, https://, or path. If you already called RUM.enable(...) in the previous step, merge the urlSessionTracking setting below into that same RUM.Configuration; do not enable RUM twice.
AppDelegate.swift
Configuring example.com also matches subdomains such as api.example.com. sampleRate must be between 0 and 100; lower it in production according to your sampling policy.
Enable Trace:If you need Trace span collection or manual span APIs, enable Trace after Datadog.initialize(...):
AppDelegate.swift
To let the Trace feature automatically create spans for first-party URLSession requests, configure the same first-party hosts in Trace.Configuration and use the following call instead of the plain Trace.enable() above:
AppDelegate.swift
Enable URLSession Tracking:To monitor network requests sent from URLSession instances, enable URLSessionInstrumentation and pass your delegate class type:
Auto-tracked Network Information:
  • Request URL, method, status code
  • Request and response headers
  • Request duration and data size
  • Network error information
  • Trace headers injected for sampled first-party requests, such as x-datadog-*, traceparent, and tracestate
Only network requests initiated while a view is active are recorded as RUM Resources. Backend services must receive and propagate these trace headers to complete frontend-backend trace correlation.

View tracking

Flashduty iOS SDK supports automatic tracking of UIKit and SwiftUI views.

UIKit view auto tracking

UIKit views are automatically tracked through DefaultUIKitRUMViewsPredicate. The SDK tracks UIViewController lifecycle, automatically recording view display and hide events.

SwiftUI view tracking

For SwiftUI apps, add the .trackRUMView() modifier to views:
The trackRUMView(name:) method automatically starts and stops view tracking when SwiftUI views appear and disappear.

Custom view tracking

For more granular control, manually track views:

User action tracking

UIKit action auto tracking

User actions in UIKit (like button taps, switch toggles) are automatically tracked through DefaultUIKitRUMActionsPredicate.

SwiftUI action tracking

For SwiftUI controls, add the .trackRUMTapAction() modifier:
Using .trackRUMTapAction(name:) inside List may affect default gestures (for example, disabling Button actions or breaking NavigationLink). For List elements, recommend using custom action API.

Custom action tracking

Manually track user actions:

Advanced configuration

Track errors

Flashduty iOS SDK automatically captures app crashes and uncaught exceptions. You can also manually record errors:
All error information is displayed in the console’s RUM Explorer, including error stack, attributes, and JSON details.
For detailed error reporting configuration, see iOS Error Reporting.

Track background events and user information

To track background events (which creates additional sessions and affects billing) or set user information, see Track background events and Track user sessions in Advanced configuration.

Offline data handling

The iOS SDK ensures data availability when the user’s device is offline:
  • When the network signal is weak or the battery is low, events are stored locally in batches.
  • When the network recovers, the batches are uploaded automatically.
  • Old data is cleaned up automatically to limit disk usage.

WebView integration

If your iOS app contains WKWebView, you can enable WebView tracking to monitor web content performance and errors.
1

Add WebView Dependency

When adding package dependencies in Swift Package Manager, also add the FlashcatWebViewTracking module.
2

Enable WebView Tracking

Enable WebView tracking in your ViewController:
Parameter Description:
  • webView - WKWebView instance to track
  • hosts - List of domains to track, supports wildcards (for example, *.example.com)
Web pages in WebView can now be correlated with native app RUM data.

Disable auto user data collection

To comply with privacy regulations or organizational data governance policies, you can disable automatic user data collection.
1

Go to Application Management

After creating an application, go to the Application Management page and click your application.
2

Configure Data Collection

Click the User Data Collection option and use toggles to control the following settings:
  • Client IP collection
  • Geo-location data collection

Verify integration

After integration, verify that the integration is successful:
1

Check Console Logs

Search for Datadog keyword in Xcode console to view SDK initialization and data reporting logs.
2

Access Console

Log in to Flashduty console, go to the corresponding RUM application, and check if data is being reported.
3

Trigger Test Events

Perform the following actions in the app to verify data collection:
  • Open different pages in the app to verify page view events
  • Perform user actions (taps, swipes) to verify interaction events
  • Trigger network requests to verify resource loading events
  • Manually trigger an error to verify error tracking
If you see data reporting and data appears in the console, the integration is successful!

Next steps

Advanced Configuration

Configure advanced SDK features like custom sampling, user identification, global context, and so on.

Data Collection

Learn about data types and data structures collected by the SDK

Insights

View and analyze app performance, errors, and user behavior data

Error Tracking

Configure crash reporting and error tracking features