This page is not yet available in Spanish. We are working on its translation.
If you have any questions or feedback about our current translation project, feel free to reach out to us!

Overview

If you experience unexpected behavior with Datadog RUM, use this guide to resolve issues quickly. If you continue to have trouble, contact Datadog Support for further assistance.

Check if Datadog SDK is properly initialized

After you configure Datadog SDK and run the app for the first time, check your debugger console in Xcode. The SDK implements several consistency checks and outputs relevant warnings if something is misconfigured.

Debugging

When writing your application, you can enable development logs by setting the verbosityLevel value. Relevant messages from the SDK with a priority equal to or higher than the provided level are output to the debugger console in Xcode:

Datadog.verbosityLevel = .debug

You should then see an output similar to the below, indicating that a batch of RUM data was properly uploaded:

[DATADOG SDK] 🐶  17:23:09.849 [DEBUG]  (rum) Uploading batch...
[DATADOG SDK] 🐶  17:23:10.972 [DEBUG]     (rum) accepted, won't be retransmitted: success

Recommendation: Use Datadog.verbosityLevel in the DEBUG configuration, and unset it in RELEASE.

Using DDURLSessionDelegate with your own session delegate

If you want to automatically track network requests with DDURLSessionDelegate but your app already implements its own session delegate, you can use either inheritance or composition patterns and forward calls to DDURLSessionDelegate.

When using an inheritance pattern, use DDURLSessionDelegate as a base class for your custom delegate and make sure to call the super implementation from your overridden methods. For example:

class YourCustomDelegateURLSessionDelegate: DDURLSessionDelegate {
    override func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {
        super.urlSession(session, task: task, didCompleteWithError: error) // forward to Datadog delegate
        /* your custom logic */
    }
}

When using a composition pattern, leverage Datadog’s __URLSessionDelegateProviding protocol to keep an internal instance of DDURLSessionDelegate and forward calls to ddURLSessionDelegate. For example:

private class YourCustomDelegateURLSessionDelegate: NSObject, URLSessionTaskDelegate, URLSessionDataDelegate, __URLSessionDelegateProviding {
    // MARK: - __URLSessionDelegateProviding conformance

    let ddURLSessionDelegate = DDURLSessionDelegate()

    // MARK: - __URLSessionDelegateProviding handling

    func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics) {
        ddURLSessionDelegate.urlSession(session, task: task, didFinishCollecting: metrics) // forward to Datadog delegate
        /* your custom logic */
    }

    func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {
        ddURLSessionDelegate.urlSession(session, task: task, didCompleteWithError: error) // forward to Datadog delegate
        /* your custom logic */
    }

    func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) {
        ddURLSessionDelegate.urlSession(session, dataTask: dataTask, didReceive: data) // forward to Datadog delegate
        /* your custom logic */
    }
}

Note: If using composition, ddURLSessionDelegate must receive all necessary calls listed in __URLSessionDelegateProviding protocol comments. Your delegate needs to:

“Deobfuscation failed” warning

A warning appears when deobfuscation fails for a stack trace. If the stack trace is not deobfuscated to begin with, you can ignore this warning. Otherwise, use the RUM Debug Symbols page to view all your uploaded dSYMs. See Investigate Obfuscated Stack Traces with RUM Debug Symbols.

Further Reading