Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Relic Solutions: How to use different app tokens in Xcode post build script for Release vs Debug

mobile

#1

One of the great features of New Relic Mobile monitoring is our powerful Crash Analysis feature which allows you to dive into crash data. We also have a few helpful tips posted under Mobile Level-Up.

In order to symbolicate iOS crashes a dSYM file needs to be uploaded. Our iOS agent includes a post build script which uploads these dSYMs automatically for you. For more details check out the Level-Up post on iOS dSYM upload deep-dive.

What if I use different app tokens for production and debug?

Alright, I hear ya! Using separate app tokens for production and debug builds helps keep your production data clean from test data. It also allows for easy viewing of test data without being obfuscated by production traffic. But how can I send dSYMs for both without using the manual upload process?

This is pretty simple. You can replace the standard build script to your target’s Build Phases with the example below replacing “TOKEN_HERE” with your application tokens:

SCRIPT=`/usr/bin/find "${SRCROOT}" -name newrelic_postbuild.sh | head -n 1`
if [ ${CONFIGURATION} = "Release" ]; then
echo "Using Production Agent Token"
AGENT_TOKEN="RELEASE_APP_TOKEN_HERE"
else
echo "Using Dev Agent Token"
AGENT_TOKEN="DEBUG_APP_TOKEN_HERE"
fi
/bin/sh "${SCRIPT}" "${AGENT_TOKEN}"

Troubleshooting

The iOS dSYM upload deep-dive is a great place to start. There’s a lot of helpful information there regarding dSYMS.

As always if the app is Bitcode enabled then this automatic upload process won’t work for you. Bitcode enabled apps are build on Apple servers. The dSYMs for these builds must be downloaded through iTunesConnect or the Xcode Organizer and manually uploaded.