Docs » Supported integrations in Splunk Observability Cloud » Instrument mobile and web applications for Splunk RUM » Instrument iOS applications for Splunk RUM » Install the iOS RUM library for Splunk RUM

Install the iOS RUM library for Splunk RUM πŸ”—

To instrument your iOS application using the iOS RUM library and get data into Splunk RUM, follow the instructions on this page. You can install the library using Swift Package Manager, CocoaPods, or by building an XCFramework.

Note

Splunk APM is not required to instrument Splunk RUM for iOS.

Decide which version to run in your environment πŸ”—

Latest updates automatically whenever Splunk RUM releases a new version. In pre-production, use latest to try out the most recent version of Splunk RUM. In production environments, use the pinned version which was previously tested in pre-production and update the production version on a monthly cycle.

Check compatibility and requirements πŸ”—

Splunk RUM for Mobile supports the following versions:

  • iOS 11 and higher

  • iPadOS 13 and higher

Splunk RUM supports Apple Silicon.

Generate customized instructions using the guided setup πŸ”—

Before you instrument and configure Splunk RUM for your iOS application, understand which data RUM collects about your application and determine the scope of what you want to monitor. See Data collected by Splunk RUM.

Tip: To generate all the basic installation commands for your environment and application, use the iOS Instrumentation guided setup. To access the iOS Instrumentation guided setup, follow these steps:

  1. Log in to Splunk Observability Cloud.

  2. In the navigation menu, select Data Management.

  3. Go to the Available integrations tab, or select Add Integration in the Deployed integrations tab.

  4. In the integration filter menu, select By Use Case.

  5. Select the Monitor user experience use case.

  6. Select the iOS Instrumentation tile to open the iOS Instrumentation guided setup.

Install the iOS RUM library manually πŸ”—

To install the iOS RUM library manually, follow these steps:

Add the dependency in Xcode πŸ”—

To add the iOS RUM package to your project, follow the steps for your dependency manager. To build an XCFramework, see Build an XCFramework.

Swift package manager (SPM) πŸ”—

To install the iOS RUM library using the Swift Package Manager (SPM) follow these steps:

  1. In Xcode, select File, then Add Packages… or File, then Swift Packages, then Add Package Dependency, and enter the following URL in the search bar:

    https://github.com/signalfx/splunk-otel-ios

  2. Select Add Package to install the package.

Note

If you are also using CocoaPods, add the SPM package to the app’s project, not to the Pods project in your workspace.

CocoaPods πŸ”—

To install the iOS RUM library using CocoaPods follow these steps:

  1. Make sure your project is using CocoaPods.

  2. Add pod 'SplunkOtel to your Podfile.

  3. Run pod install --repo-update in the directory where the Podfile is located.

  4. After installing the pod, make sure to open the .xcworkspace file instead of the .xcodeproj file.

Initialize the iOS RUM package πŸ”—

Follow these steps to initialize the iOS RUM package.

  1. Initialize the iOS RUM library with your configuration parameters:

    import SplunkOtel
    //..
    SplunkRumBuilder(realm: "<realm>", rumAuth: "<rum-token>")
    // Call functions to configure additional options
       .deploymentEnvironment(environment: "<environment>")
       .setApplicationName("<your_app_name>")
       .build()
    
  2. Deploy the changes to your application.

Activate crash reporting πŸ”—

The Splunk iOS Crash Reporting module adds crash reporting to the iOS RUM library using PLCrashReporter.

Caution

Before activating crash reporting in the iOS RUM library, deactivate any other crash reporting package or library in your application. Existing crash reporting functionality might produce unexpected results, including build failures.

To activate crash reporting in the iOS RUM library, follow these steps.

Add the dependency πŸ”—

To add the iOS Crash Reporting package to your project, follow the steps for your package manager.

Swift package manager (SPM) πŸ”—

To install the iOS RUM library using the Swift Package Manager (SPM) follow these steps:

  1. In Xcode, select File, then Add Packages… or File, then Swift Packages, then Add Package Dependency, and enter the following URL in the search bar:

    https://github.com/signalfx/splunk-otel-ios-crashreporting

  2. Select Add Package to install the package.

CocoaPods πŸ”—

To install the iOS Crash Reporting package using CocoaPods follow these steps:

  1. Make sure your project is using CocoaPods.

  2. Add pod 'SplunkOtelCrashReporting to your Podfile.

  3. Run pod install --repo-update in the directory where the Podfile is located.

  4. After installing the pod, make sure to open the .xcworkspace file instead of the .xcodeproj file.

Initialize Crash Reporting πŸ”—

Initialize the crash reporting module with your configuration parameters:

import SplunkOtel
import SplunkOtelCrashReporting

import SplunkOtel
//..
SplunkRumBuilder(realm: "<realm>", rumAuth: "<rum-token>")
   .deploymentEnvironment(environment: "<environment>")
   .setApplicationName("<your_app_name>")
   .build()
// Initialize crash reporting module after the iOS agent
SplunkRumCrashReporting.start()

Note

Symbolication is not supported.

Build an XCFramework πŸ”—

If you want to import the iOS RUM Agent as a framework into your project, follow these steps:

  1. Check the build settings

Clone the splunk-otel-ios repository and open the SplunkRumWorkspace.xcworkspace file in Xcode.

Navigate to the Build Settings tab on the SplunkOtel target and make sure the following settings are present:

  • Skip Install: No

  • Build Libraries for Distribution: Yes

  1. Create a new archives directory

Open a terminal and navigate to the directory where the SplunkRum.xcodeproj file is located, for example SplunkRumWorkspace/SplunkRum.

Run the following command to create a new archives directory containing the SplunkRum-iOS.xcarchive file:

xcodebuild archive -project SplunkRum.xcodeproj -scheme SplunkOtel -destination "generic/platform=iOS" -archivePath "archives/SplunkRum-iOS"

Repeat the process for the simulator platform:

xcodebuild archive -project SplunkRum.xcodeproj -scheme SplunkOtel -destination "generic/platform=iOS Simulator" -archivePath "archives/SplunkRum-iOS_Simulator"
  1. Create the new XCFramework

Run the following command to create the XCFramework:

xcodebuild -create-xcframework -archive archives/SplunkRum-iOS.xcarchive -framework SplunkOtel.framework -archive archives/SplunkRum-iOS_Simulator.xcarchive -framework SplunkOtel.framework -output xcframeworks/SplunkOtel.xcframework
  1. Import the XCFramework into your project

Open your project in Xcode and drag the SplunkOtel.xcframework file into the project navigator. This automatically imports the framework. Go into the General tab in any targets using the framework and set their Embed property to Embed & Sign.

Instrument iOS WebViews using the Browser RUM library πŸ”—

You can use Mobile RUM instrumentation and Browser RUM instrumentation simultaneously to see RUM data combined in one stream. You can do this by sharing the splunk.rumSessionId between both instrumentations.

The following Swift snippet shows how to integrate iOS RUM with Splunk Browser RUM:

import WebKit
import SplunkOtel

...
   /*
Make sure that the WebView instance only loads pages under
your control and instrumented with Splunk Browser RUM. The
integrateWithBrowserRum() method can expose the splunk.rumSessionId
of your user to every site/page loaded in the WebView instance.
*/
   let webview: WKWebView = ...
   SplunkRum.integrateWithBrowserRum(webview)

Change attributes before they’re collected πŸ”—

To remove or change attributes in your spans, such as personally identifiable information (PII), see Filter spans.

How to contribute πŸ”—

The Splunk OpenTelemetry Instrumentation for iOS is open-source software. You can contribute to its improvement by creating pull requests in GitHub. To learn more, see the contributing guidelines in GitHub.

Next steps πŸ”—

This page was last updated on May 08, 2024.