iOS Troubleshooting Framework Install and Config

  1. Follow iOS Agent Installation Guide: iOS Installation for CocoaPods or Manual Installation for iOS (Latest Agent version recommended: iOS Release Notes)

  2. Agent is started in the first line of the application:didFinishLaunchingWithOptions in the AppDelegate.swift file.

  • To ensure proper instrumentation, you must call the agent on the first line of didFinishLaunchingWithOptions(), and run the agent on the main thread. Starting the call later, on a background thread, or asynchronously can cause unexpected or unstable behavior.
  • iOS can only support one Crash Handler so it is integral that our Agent is first in the method and that other Handlers are disabled or crashes may not get to New Relic.
  1. Add a build script to your target’s Build Phases. Ensure the new build script is the very last build phase, then paste the following, replacing PUT_NEW_RELIC_APP_TOKEN_HERE with your application token:
SCRIPT=`/usr/bin/find "${SRCROOT}" -name newrelic_postbuild.sh | head -n 1`

/bin/sh "${SCRIPT}" "PUT_NEW_RELIC_APP_TOKEN_HERE"
  1. Review our Compatibility Requirements to avoid installation, runtime, or build errors.

  2. Enable/Disable agent feature flags as desired, and place them before agent start: iOS Agent Configuration and Feature Flags

  3. Add Custom Data, if applicable.

  4. Review data reporting issues by checking the Agent’s messages in the console: iOS Logging Level (ALL level recommended)

  • To get agent messages, they need to set the environmental variable in Xcode to print device logs: Product>>Scheme>>Edit Scheme: Environmental Variable OS_ACTIVITY_MODE
  1. Adjust the agent’s harvest cycle timer, or event pool to prevent data loss caused by harvest data limits:
  1. Test a Crash or Troubleshoot Errors

  2. If you are still experiencing issues after installing the iOS agent in accordance to the Installation Documentation, please contact support and provide the following: