Introducing Configuration Flags and Beta NSURLSession Support for iOS

As we add more features to the iOS agent we want to give you the option of accessing newer features as soon as they become available. We’re now introducing the ability to enable and disable new functionality for the New Relic iOS SDK at your discretion. With this release we are including flags to enable NSURLSession instrumentation, and more features will soon follow along, so keep an eye out! More detailed documentation is available in the iOS SDK NewRelic.h header file.

The New Relic iOS Agent now supports instrumentation of NSURLSession, a new networking framework added in iOS 7.0. As a beta feature you’ll need to manually enable it by calling:

[NewRelic enableFeatures:NRFeatureFlag_NSURLSessionInstrumentation];

… before you call …

[NewRelic startWithApplicationToken:'Your Token'];.

You’ll now be able to monitor NSURLSession traffic along with NSURLConnection, UIWebView, and ASI frameworks. Just click the “Network” tab for your mobile app and dive into HTTP requests, errors, geography, and carrier data! You can read more about our network monitoring features here.

bryce app

The new instrumentation of NSURLSession includes all network traffic dispatched using NSURLSessionDataTask and NSURLSessionUploadTask with either delegate or block call-back models. NSURLSessionDownloadTask is not currently instrumented due to the backgrounding nature of this particular NSURLSessionTask.

Due to limitations of the framework we had to replace the NSURLSession delegate at runtime with an NRURLSessionDelegateBase object, but if you need access to your delegate after the NSURLSession is created you can still access it via the realDelegate property of NRURLSessionDelegateBase.

As always, we’re eager to hear your feedback. If you’d like your favorite 3rd party library instrumented, just let us know over at the Community Forum.'

Bryce Buchanan is an iOS Engineer on the Mobile Agent team at New Relic. Prior to joining New Relic, he designed and build iOS applications for a small company in Seattle with over 30 app accepted to the AppStore. View posts by .

Interested in writing for New Relic Blog? Send us a pitch!