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 via Swift Package Manager or CocoaPods, use names like
FlashcatCore and FlashcatRUM, but in code, import modules like DatadogCore and DatadogRUM. You can seamlessly leverage Datadog ecosystem documentation, examples, and best practices while enjoying Flashduty platform services.Integration Steps
Add SDK Dependencies
Flashduty iOS SDK supports Swift Package Manager and CocoaPods:
- Swift Package Manager
- CocoaPods
- In Xcode, open your project and select File > Add Package Dependencies
-
Enter the Flashduty SDK Git repository URL:
-
Select version rule:
- Recommended: Select Up to Next Major Version and enter the latest version number (e.g.,
0.3.0) - This allows bug fixes and minor updates while maintaining compatibility
- Recommended: Select Up to Next Major Version and enter the latest version number (e.g.,
- Click Add Package and wait for Xcode to download dependencies
-
In the Choose Package Products window, select modules to add to your Target:
FlashcatCore- Core SDK (required)FlashcatRUM- RUM feature module (required)FlashcatWebViewTracking- WebView tracking (optional)FlashcatCrashReporting- Crash reporting (recommended)
- Ensure each module is linked to the correct Target, click Add Package to complete
Get Application Credentials
In the Flashduty console’s RUM Application Management page:
- Create or select an iOS application
- Get the following credentials:
- Application ID - Application unique identifier
- Client Token - Client access token
Initialize SDK
Initialize the SDK in your TrackingConsent States:
AppDelegate.swift’s application(_:didFinishLaunchingWithOptions:) method:AppDelegate.swift
Parameter Description:
clientToken- Client token obtained from console (required)env- Environment name, e.g.,production,staging(required)trackingConsent- User tracking consent state (see below)
| State | Behavior |
|---|---|
.granted | Start collecting data and send to Flashduty |
.pending | Start collecting and batching data, but don’t send, wait for confirmation |
.notGranted | Do not collect any data |
Enable RUM Features
Configure and enable RUM features. Recommend enabling early in
AppDelegate:AppDelegate.swift
Configuration Parameter Description:
applicationID- RUM application ID obtained from consoleuiKitViewsPredicate- UIKit view tracking strategyuiKitActionsPredicate- UIKit user action tracking strategyswiftUIViewsPredicate- SwiftUI view tracking strategyswiftUIActionsPredicate- SwiftUI user action tracking strategyurlSessionTracking- 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
Configure Network Tracking (Optional)
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
Only network requests initiated while a view is active are tracked.
View Tracking
Flashduty iOS SDK supports automatic tracking of UIKit and SwiftUI views.UIKit View Auto Tracking
UIKit views are automatically tracked via
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:
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, etc.) are automatically tracked via
DefaultUIKitRUMActionsPredicate.SwiftUI Action Tracking
For SwiftUI controls, add the.trackRUMTapAction() modifier:
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
You can track events when the app is running in the background (e.g., crashes and network requests):Track User Information
You can set user information for the current session to track specific user behavior:Offline Data Handling
The iOS SDK ensures data availability when the user’s device is offline:Data Persistence Mechanism:
- Events are stored locally in batches when network signal is weak or device battery is low
- Automatically uploaded when network recovers, ensuring no data loss
- Old data is automatically cleaned up to avoid excessive disk usage
Even if users use the app while offline, data is retained and uploaded when network recovers, ensuring no monitoring data is lost.
WebView Integration
If your iOS app contains WKWebView, you can enable WebView tracking to monitor web content performance and errors.Add WebView Dependency
When adding package dependencies in Swift Package Manager, also add the
FlashcatWebViewTracking module.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.Go to Application Management
After creating an application, go to the Application Management page and click your application.
Verify Integration
After integration, verify that the integration is successful:Check Console Logs
Search for
Datadog keyword in Xcode console to view SDK initialization and data reporting logs.Access Console
Log in to Flashduty console, go to the corresponding RUM application, and check if data is being reported.
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, etc.) 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, etc.
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