Follow these instructions to install and configure the iOS agent.
Tip
tvOS apps using Cocoapods have separate installation procedures.
Installing your tvOS application
As part of the installation process, New Relic automatically generates an application token. This is a 40-character hexadecimal string for authenticating each mobile app you monitor.
For Admins with existing New Relic accounts, follow these steps to install and configure your application. (If you don't have a New Relic account, signup at newrelic.com/signup—it's free, forever.)
- Go to one.newrelic.com > Mobile.
- If applicable: From the Mobile Apps list, select Add a new app
- From the Get Started page, select tvOS as the platform for mobile monitoring.
- Type a name for your mobile app, and select Continue.
Configuring your tvOS application
These procedures to configure your tvOS app are also available on the Get Started page in the mobile monitoring UI.
Download and unzip the tvOS SDK.
To add the New Relic tvOS Mobile Framework to your Xcode project: Use Finder to drag the NewRelicAgentTVOS.framework folder into your Xcode project, and drop it onto your Project in the Project Navigator window.
Follow the prompts to copy items into destination and to create folder references.
Add the SystemConfiguration.framework, libc++.tbd, and libz.tbd libraries to your Linker settings.
To start the agent: Import the tvOS agent header at the top of your prefix.pch.
Add +[NewRelic startWithApplicationToken:<appToken>] to the top of -application:didFinishLaunchingWithOptions: in your AppDelegate.m using the unique application token that is automatically generated.
Add a build script to your target's Build Phases and 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"Clean and build your app, and then run it in the simulator or other device.
Within a few minutes you will begin to see data for your iOS app: Go to one.newrelic.com > Mobile > (select an app). If you don't, see No data appears.
Executing a demo crash (optional)
If you have trouble getting your app to crash, the New Relic agent provides an API to execute a demo crash.
Recommendation: Add one of these lines of code to a button click event handler as applicable:
[NewRelic crashNow];
OR
[NewRelic crashNow:@"<reason>"];
Changing the logging level (optional)
By default the New Relic agent will log at the info
level. Increasing the log level to verbose
or higher priority is only encouraged for debugging and not for release builds. Verbose level or higher priority will log all API interactions with the New Relic server.
Six log levels are available for mobile monitoring:
none
error
warning
info
verbose
ALL
To increase your logging level in the app, add this method call before calling startWithApplicationToken:
[NRLogger setLogLevels:NRLogLevelALL];