Skip to content

Instantly share code, notes, and snippets.

@djGrill
Last active March 19, 2020 09:20
Show Gist options
  • Save djGrill/f1a969bc646db75a9d72a6c77f1c4955 to your computer and use it in GitHub Desktop.
Save djGrill/f1a969bc646db75a9d72a6c77f1c4955 to your computer and use it in GitHub Desktop.
[react-native-newrelic] iOS configuration

Requirements

  • react-native: 0.59.10

Installation

Install react-native-newrelic

npm install react-native-newrelic --save

Download and unzip the New Relic iOS SDK (Version 5.14.2)

https://docs.newrelic.com/docs/release-notes/mobile-release-notes/ios-release-notes/ios-agent-5142

Add the New Relic Mobile framework to your project

  • Use Finder to drag the NewRelicAgent.framework folder into your Xcode project, and drop it onto your project in the Project navigator window (inside the Frameworks folder).
  • When prompted, select "Copy items into destination..." and "Create folder references...".

Add these four libraries to your Linker settings

  • Click on your Project in the Project Navigator window, under Targets select your app, and click the Build Phases tab.
  • Open the Link Binary with Libraries list. Click the plus sign and add these:
CoreTelephony.framework
SystemConfiguration.framework
libc++.tbd
libz.tbd

AppDelegate.m

  • Add #import <NewRelicAgent/NewRelic.h>.
  • Add this call as the first line of application:didFinishLaunchingWithOptions:
[NewRelicAgent startWithApplicationToken:@"<YOUR APP TOKEN>"];

Configuration

Add the following to your app root (e.g. app.ios.js ):

import {default as newRelic} from 'react-native-newrelic';

newRelic.init({
  overrideConsole: true,
  reportUncaughtExceptions: true,
  globalAttributes: {
    'this-string': 'will be sent with every event that is being reported'
  }
});

References

Related Issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment