New Relic Mobile now comes with more chocolate! Well, more CocoaPods support, I should say. That’s right, we are now officially adding support for CocoaPods in your iOS apps.
Adding New Relic to CocoaPods couldn’t be easier! Every time we release new versions of the iOS agent, we will update the “NewRelicAgent” Podspec, so you’ll always have the latest and greatest release.
For mobile developers who are already using CocoaPods, simply follow the steps below and in moments, you’ll be on your way to consuming delicious data. For those of you who aren’t using CocoaPods, head over to the CocoaPods site to get started and then come back to add New Relic!
Here are the five simple steps:
Step 1
In the Podfile for your project, add the following line:
pod 'NewRelicAgent'
Step 2
Close your project in Xcode, and update it by running this command from the Terminal in your project directory:
pod install
Step 3
Open your project in Xcode by running this command (replacing “App” with your app name) from the Terminal in your project directory:
open App.xcworkspace
Step 4
In your [app_name]-Prefix.pch project file (generally found in the Supporting Files folder), include the New Relic header:
#import <NewRelicAgent/NewRelic.h>
Step 5
In your AppDelegate.m file, add this call as the first line of application:didFinishLaunchingWithOptions:
[NewRelicAgent startWithApplicationToken:@"<appToken>"];
Clean and build your app, and then run it in the simulator or another device.
Now that you’ve installed New Relic in your app, within minutes you will see all the awesome New Relic Mobile performance monitoring data in your New Relic account dashboard.
Happy mobile monitoring!