New Relic Mobile'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:)
For an explanation of Mobile custom data types, see Add custom data to New Relic Mobile.
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 Enable a feature flag: +[NewRelic enableFeatures:(NRMAFeatureFlags)flags]; Disable a feature flag: +[NewRelic disableFeatures:(NRMAFeatureFlags)flags]; Here is an example where:
[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:
|
Crash and error reporting feature flag
If used, be sure to call the feature flag before the New Relic iOS agent start call.
- NRFeatureFlag_CrashReporting
-
Enable (default) or disable crash reporting, which appears on New Relic Mobile's Crash analysis page.
Type Boolean Default true
- NRFeatureFlag_HandledExceptionEvents
-
Globally enable (default) or disable recording handled exceptions events, which appear on the Handled exception page.
Type Boolean Default true
Interactions feature flags
If used, be sure to call the feature flag before the New Relic iOS agent start call.
- NRFeatureFlag_DefaultInteractions
-
Enable (default) or disable interaction tracing only for default instrumented classes and methods. Custom interactions will be reported. The traces will appear on the Mobile Interactions page.
Type Boolean Default true
- NRFeatureFlag_InteractionTracing
-
Globally enable (default) or disable interaction traces, which appear on the Mobile Interactions page.
Interaction tracing will be disabled after the agent has started. Interactions for any activity or methods executed prior to starting the agent may still appear on the Interactions page.
Type Boolean Default true
- NRFeatureFlag_SwiftInteractionTracing
-
Before enabling this feature, see Enable Swift interaction traces. If proper steps are not taken, enabling this feature may cause instability.
Enable or disable (default) interaction tracing for Swift code. The traces appear on the Mobile Interactions page. This feature will always be disabled if
NRFeatureFlag_InteractionTracing
is disabled.Type Boolean Default false
Networking feature flags
If used, be sure to call the feature flag before the New Relic iOS agent start call.
- NRFeatureFlag_ExperimentalNetworkingInstrumentation
-
Enabling this feature flag call may decrease the stability of applications. Avoid using unless instructed by New Relic.
Enable or disable (default) experimental networking instrumentation. This forces all
NSURLConnection
network requests through theNRMAURProtocol
.Type Boolean Default false
- NRFeatureFlag_NSURLSessionInstrumentation
-
Enable (default) or disable networking instrumentation for
NSURLSession
. These URL traces are sent to the HTTP Requests page.Type Boolean Default true
- NRFeatureFlag_NetworkRequestEvents
-
Enable or disable (default) networking instrumentation. This sends the HTTP response data to Insights as MobileRequest events.
Available for iOS Agent version 5.14.0 and higher
Type Boolean Default true
- Enabled by default as of 6.0.0 - NRFeatureFlag_RequestErrorEvents
-
Enable (default) or disable HTTP request error event generation of instrumented network calls that result in an error or failure. These events are sent to Insights as MobileRequestError events.
Available for iOS Agent version 5.11.0 and higher
Type Boolean Default true
- NRFeatureFlag_HttpResponseBodyCapture
-
Enable or disable capture of HTTP response bodies for HTTP error traces, and MobileRequestError events.
Type Boolean Default true