Integrate New relic using carthage package manager

Viewed 326

Is there any way i can integrate New Relic sdk into my iOS project using carthage package manager? I don't want to use cocoa pods to do this since i am already using carthage package manager in my project.

1 Answers

Fetch the package via Carthage

To use Carthage there are a few steps. First inside of your Carthage/ Directory add a file called new_relic.json and add this to it:

{
  "6.7.0": "https://download.newrelic.com/ios_agent/NewRelic_iOS_Agent_6.7.0.zip"
}

Then in your Cartfile add this line:

binary "./Carthage/new_relic.json" == 6.7.0

Finally run carthage update --platform ios

Integrate New Relic

  1. After you run your update command and you have the package, go to the general tab and add all of these packages to the Linked Frameworks and Libraries section:

Linked Frameworks and Libraries

  1. Add a bridging header to your project and add this line of code

#import "NewRelicAgent/NewRelic.h"

  1. Then add this script to your build phases section:
 SCRIPT=`/usr/bin/find "${SRCROOT}" -name newrelic_postbuild.sh | head -n 1`
 /bin/sh "${SCRIPT}" "Your token here"
  1. And this line of code to didFinishLaunchingWithOptions

NewRelic.start(withApplicationToken:"Your Token Here")

Related