I have recently discovered that working with third party libraries and building your project outside your Xcodeenvironment could be kind of tricky if you are not really an expert.
This document will show how to add the NewRelic framework to your ios project and build it on Jenkins.
The first thing you will need to do is to access/sign up on NewRelic from CloudBees (Services-->Add Services-->Select New Relic)
Access NewRelic and create a new mobile application:
You will need to download the NewRelic sdk and add it to your IOS project.
Here there is a well-done tutorial on how to import NewRelic framework in your IoS project: https://rpm.newrelic.com/accounts/422541/mobile/setup
Once you have followed this guide and you have your project correctly configured locally, it’s time to put it somewhere so that your jenkin job will be able to pull your code and build it.
You can use the SCM that you prefer, in this example we will use github.
If you do not have an account on github, create one, and commit your code there. This is how the structure of my demo-project looks like on my github account:
Go on your jenkins instance on cloudbees: https:/.ci.cloudbees.com/
and create a new job configuring it so that it’s ready to build IOS project as explained in this step-by-step guide:
Of course you will need to change the git repo so that it points to your project.
Try now to build your project.
As you see, you will have an annoying error saying that the NewRelic framework can’t be found.
So, here we go: XCode compiler looks for the frameworks in a default path which won’t work on our agent since the workspace structure now looks different.
The trick is to configure the Framework Search Path in Xcode to look recursively anywhere in the project workspace:
open your project in XCode
go to Build Settings
look for “framework search Paths”
add a new “./” recursive path
Build it locally to check it still works locally and commit your changes on github.
Go to your Jenkins Job and build it again:
Now it builds successfully !
Stay up to date
We'll never share your email address and you can opt out at any time, we promise.