iOS NewRelicAgent 7.3.0 crash: unrecognized selector, ‘_RX_namespace_viewDidAppear

Hi, I added NewRelicAgent 7.3.0 into my iOS app via Cocoapods and launching it as follows

    enableCrashReporting(false)
    let featuresToDisable: NRMAFeatureFlags = [
        .NRFeatureFlag_DefaultInteractions,
        .NRFeatureFlag_HandledExceptionEvents,
        .NRFeatureFlag_CrashReporting
    ]
    disableFeatures(featuresToDisable)
    start(withApplicationToken: applicationToken)

When the app launches on iOS Simulator and I navigate to a screen the app crashes with the following exception:

*** Terminating app due to uncaught exception ‘NRInvalidArgumentException’, reason: ‘New Relic detected an unrecognized selector, ‘_RX_namespace_viewDidAppear:’, sent to ‘UIViewController’. It’s possible _cmd was renamed by an unsafe method_exchangeImplementations().’

This appears to be some kind of incompatibility with RxSwift.

When I pass .NRFeatureFlag_InteractionTracing to disableFeatures() this crash goes away but this effectively makes it imposible to use interaction tracing.

Is there a way to avoid this crash?

We’ve encountered these issues in iOS apps when other 3rd party libraries (notably RxSwift) swizzle, and if it is done in a different manner, a conflict occurs making our instrumentation unable to find the original method.

In most cases, interaction tracing needs to be disabled completely with the agent feature flag NRFeatureFlag_InteractionTracing, but this can vary in each case.

It may be possible to only disable default interactions, using NRFeatureFlag_DefaultInteractions. This will only disable the agent’s default interaction instrumentation, and you should be able to create custom interactions in their place.

That said, if you need all interaction tracing disabled, breadcrumbs and timers can be used to capture similar data instead.