• /
  • Log in
  • Free account

iOS agent configuration and feature flags

New Relic's iOS agent provides configuration settings to change the default behavior of the agent. If used, implement these flags just before calling:

  • Objective-C: +[NewRelic startWithApplicationToken:]
  • Swift: NewRelic.start(withApplicationToken:)

Enable or disable feature flags

To configure feature flags, use the following method defined in NewRelic.h:

iOS language

Procedure

Objective-C

In Objective-C, these features are bitmasked, so you can use a | to enable or disable multiple features at the same time.

Enable a feature flag:

+[NewRelic enableFeatures:(NRMAFeatureFlags)flags];

Disable a feature flag:

+[NewRelic disableFeatures:(NRMAFeatureFlags)flags];

Here is an example where:

  • Interaction tracing and experimental networking instrumentation are enabled.
  • NSURLSession instrumentation and crash reporting are disabled.
[NewRelic enableFeatures:NRFeatureFlag_SwiftInteractionTracing | NRFeatureFlag_ExperimentalNetworkingInstrumentation];
[NewRelic disableFeatures:NRFeatureFlag_NSURLSessionInstrumentation | NRFeatureFlag_CrashReporting];
[NewRelic startWithApplicationToken:...];

Swift

Enable a feature flag:

NewRelic.enableFeatures(NRMAFeatureFlags.[NRMAFeatureFlag])

Disable a feature flag:

NewRelic.disableFeatures(NRMAFeatureFlags.[NRMAFeatureFlag])

Example to disable interaction tracing:

NewRelic.disableFeatures(NRMAFeatureFlags.NRFeatureFlag_DefaultInteractions)

Crash and error reporting feature flag

If used, be sure to call the feature flag before the New Relic iOS agent start call.

Distributed tracing

Interactions feature flags

If used, be sure to call the feature flag before the New Relic iOS agent start call.

Networking feature flags

If used, be sure to call the feature flag before the New Relic iOS agent start call.

Create issueEdit page
Copyright © 2022 New Relic Inc.