Upgrade the Splunk RUM iOS agent

Migrate existing iOS instrumentation to the new Splunk RUM agent.

Attention: If you don't have existing iOS instrumentation, skip this page. Go directly to Install the Splunk RUM iOS agent.

If you have existing iOS agent added as a Swift Package dependency, follow these steps to upgrade your iOS applications to the new 2.0.0 Splunk RUM agent:

  1. Update the Swift Package dependency for SplunkOtel by setting the minimal version to 2.0.0 and keeping the Dependency Rule as Up to Next Major Version.
  2. Remove the package dependency SplunkOtelCrashReporting.

  3. Replace SplunkOtel library with SplunkAgent library in your project's target General settings.

  4. Delete the Package.resolved file in your project.

    The default location of this file is <projectName>.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved.

    Note: The package name of the Splunk RUM iOS agent has been changed to SplunkAgent (previously SplunkOtel)
  5. Clean your build folder.
    In the Xcode UI, select Product > Clean build folder .
  6. If you had crash reporting activated in your old Splunk RUM iOS agent, remove the following code snippet from your AppDelegate.swift or @main Content file.
    Note: Crash reports are no longer provided as a separate framework.
    import SplunkOtelCrashReporting
    
    SplunkRumCrashReporting.start()  
  7. Replace imports of SplunkOtel with SplunkAgent in your entire project:
    //Replace all "import SplunkOtel" with the following in your project
    import SplunkAgent

  8. Initialize the Splunk RUM agent:
    1. Include following code snippet in AppDelegate.swift or @main Content file in your application:

      Swift
      import SplunkAgent
      
      
      let endpointConfiguration = EndpointConfiguration(
          realm: "YOUR_REALM",
          rumAccessToken: "YOUR_RUM_ACCESS_TOKEN"
      )
      
      let agentConfiguration = AgentConfiguration(
          endpoint: endpointConfiguration,
          appName: "YOUR_APP_NAME",
          deploymentEnvironment: "YOUR_DEPLOYMENT_ENVIRONMENT"
      )
      
      var agent: SplunkRum?
      
      do {
          agent = try SplunkRum.install(with: agentConfiguration)
      } catch {
          print("Unable to start the Splunk agent, error: \(error)")
      }
      
      // Example: Enable automated navigation tracking
      agent?.navigation.preferences.enableAutomatedTracking = true
      
      // Example: Start session replay
      agent?.sessionReplay.start()
      Objective-C
      @import SplunkAgentObjC;
      
      
      SPLKEndpointConfiguration* endpointConfiguration = [[SPLKEndpointConfiguration alloc] initWithRealm:@"<YOUR_REALM>" rumAccessToken:@"YOUR_RUM_ACCESS_TOKEN"];
      
      SPLKAgentConfiguration* agentConfiguration = [[SPLKAgentConfiguration alloc] initWithEndpoint:endpointConfiguration appName:@"YOUR_APP_NAME" deploymentEnvironment:@"YOUR_DEPLOYMENT_ENVIRONMENT"];
          
      NSError* error = nil;
      SPLKAgent* agent = [SPLKAgent installWith:agentConfiguration error:&error];
      
      if (agent == nil) {
          NSLog(@"Unable to start the Splunk agent, error: %@", [error description]);
      } else {
          // Example: Start session replay
          [[agent sessionReplay] start];
      }
    2. Deploy the changes to your application.

The following legacy APIs have been removed and have no direct equivalent in the new Splunk RUM agent.

Configurations:

  • enableDiskCache(enabled: Bool)
  • spanDiskCacheMaxSize(size: Int64)
  • setSpanSchedulingDelay(seconds: TimeInterval)
  • allowInsecureBeacon(enabled: Bool)
  • slowFrameDetectionThresholdMs(thresholdMs: Double)
  • frozenFrameDetectionThresholdMs(thresholdMs: Double)

APIs:

  • setLocation(latitude: Double, longitude: Double)

Other APIs tagged as deprecated are backward compatible but we recommend that you replace all deprecated configurations and APIs with the new ones provided by this new Splunk RUM agent.

The new Splunk RUM iOS agent uses OTLP (HTTP/protobuf) for exporting signals to Splunk RUM. Zipkin is no longer supported.