Digital Measurement iOS Carthage Guide

From Engineering Client Portal

Revision as of 19:54, 15 December 2020 by ColinBrown (talk | contribs) (Created page with "{{Breadcrumb|}} {{Breadcrumb|Digital}} {{Breadcrumb|Digital Downloads}} {{Breadcrumb|Digital Measurement iOS Artifactory Guide}} {{CurrentBreadcrumb}} Category:Digital __...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Engineering Portal breadcrumbArrow.png Digital breadcrumbArrow.png Digital Downloads breadcrumbArrow.png Digital Measurement iOS Artifactory Guide breadcrumbArrow.png Digital Measurement iOS Carthage Guide

The Nielsen AppSDK can either be downloaded directly or can be integrated directly within an application through the use of a CocoaPods or Carthage.

How to integrate Nielsen SDK in iOS/tvOS application using Carthage

Carthage is intended to be the simplest way to add frameworks to your Cocoa application. Carthage builds your dependencies and provides you with binary frameworks, but you retain full control over your project structure and setup. Please note: Carthage does not automatically modify your project files or your build settings.

Carthage Installation

The Nielsen SDK integration requires Carthage.

Install manually

Download and run the Carthage.pkg file for the latest release, then follow the on-screen instructions. If you are installing the pkg via CLI, you might need to run sudo chown -R $(whoami) /usr/local first.

Install using homebrew

Homebrew: You can use Homebrew and install the carthage tool on your system simply by running brew update and brew install carthage. (note: if you previously installed the binary version of Carthage, you should delete /Library/Frameworks/CarthageKit.framework).

The full installation guide for the Carthage is provided on the official page.

Repository Credentials

The first step is to add the credentials received from Nielsen into your .netrc file. Navigate to your home folder and create a file called .netrc

cd ~/
vi .netrc

Within this file you need to add your credentials in the following format:

login <Nielsen App SDK client>
password <Auth token>


Please do not upload any file to github or bitbucket containing the credentials above.

This will automatically lock your access.


Obtain credentials → here ←

Carthage setup

Create a Cartfile that lists the frameworks you’d like to use in your project. A Cartfile describes your project’s dependencies to Carthage, allowing it to resolve and build them for you. The Nielsen iOS/tvOS AppSDK is distributed as compiled binary .framework. The dependency on the SDK should be specified with the "binary" keyword and as an https:// URL, that returns a binary project specification in JSON format.
For example:

# Dependency on NielsenAppSDK
binary ""

Static vs Dynamic framework

Nielsen AppSDK is distributed as static and dynamic framework. The corresponding path to the JSON file should be specified in the Cartfile depending on the selection you made.

For static framework:

binary ""

For dynamic framework:

binary ""

SDK for Different Markets

Please change the <TARGET> in the JSON path to the proper name from the list in the end of this document.

# Static AppSDK
binary "<TARGET>/NielsenAppSDK.json"
# Dynamic AppSDK
binary "<TARGET>/NielsenAppSDK.json"

For example, for NielsenAGFNoAdAppSDK target the full path is:

# Static AppSDK for NielsenAGFNoAdAppSDK
binary ""
# Dynamic AppSDK for NielsenAGFNoAdAppSDK
binary ""

Nielsen AppSDK Versions

iOS/tvOS AppSDK has 4 digits in the version numbers, but the Carthage does not support 4 digit versions. Please use only 3 first digits while specifying the exact version of the SDK. Mapping from 4 digits to 3 digits version is the following (please note, older versions are not available for Carthage deployment for some targets): -> 5.1.1 -> 6.0.0 -> 6.1.0 -> 6.2.0 -> 7.0.0 -> 7.1.0 -> 7.2.0 -> 8.0.0

Version requirement

Carthage supports several kinds of version requirements:

>= 1.0 for at least version 1.0
~> 1.0 for compatible with version 1.0
== 1.0 for exactly version 1.0

Example Cartfile

# Use the latest version
binary ""

# Require version 7.2.0 or later
binary "" >= 7.2.0

# Require version 7.x (7.0 or later, but less than 8.0)
binary "" ~> 7.0

# Require exactly version 7.2.0
binary "" == 7.2.0

Carthage Update

Once you prepare a Cartfile please run the following command.
For iOS:
carthage update --platform iOS --use-netrc
For tvOS:
carthage update --platform tvOS --use-netrc

Flag --use-netrc is needed, because in the Carthage .json file we are pointing to a private Github repo as a storage.

Framework integration for Carthage

Carthage update does not modify the application project, it just downloads the proper version into the local folder named Carthage in the same directory where the Cartfile is located.

In order to integrate the framework into your application open your application targets’ General settings tab. In the "Frameworks, Libraries, and Embedded Content" section, drag and drop NielsenAppApi.framework (NielsenTVAppApi.framework) from the Carthage/Build folder on disk. Then, in the "Embed" section, select "Do Not Embed" from the pulldown menu.

The last step is needed for the dynamic framework only. It’s a slick workaround for an App Store submission bug where apps with frameworks that contain binary images for the iOS/tvOS simulator are automatically rejected.

  • On the application targets’ Build Phases settings tab, click the + icon and choose New Run Script Phase. Create a Run Script in which you specify your shell (ex: /bin/sh), add the following contents to the script area below the shell:

/usr/local/bin/carthage copy-frameworks

  • Add the paths to the frameworks you want to use under “Input Files".

For iOS:
For tvOS:

  • Add the paths to the copied frameworks to the “Output Files”.

For iOS:
For tvOS:

Additional Frameworks

If you integrate the static version of iOS/tvOS NielsenAppSDK framework you need to link additional system frameworks to avoid linking error:

  • AdSupport.framework (for IDFA frameworks only)
  • CoreLocation.framework (needed for version 6.1.0 and earlier)
  • libsqlite3.tbd
  • SystemConfiguration.framework

The dynamic version of iOS/tvOS NielsenAppSDK framework does not require this step.

Outdated Check

Carthage provides an outdated check for integrated dependencies. To enable that you need to add the following line to the run script in the app /usr/local/bin/carthage outdated --xcode-warnings 2>/dev/null

The Carthage will check the latest available version of the SDK and report a warning every time the app is being built:

The following dependencies are outdated:
warning: NielsenAppSDK is out of date ("7.2.0" -> "7.2.0") (Latest: "8.0.0")

SDK Versions

The following SDK versions are now available for distribution through CocoaPods and Carthage: (For 'kids' apps, please use the NoId framework (EG: NielsenNoIdAppSDK, NielsenNoIdTVOSAppSDK)

Global Builds

App Flavor Name

Regional Builds

(For 'kids' apps, please use the NoId framework (EG: NielsenAGFNoIdAppSDK, NielsenAGFNoIdTVOSAppSDK)

App Flavor Name

Additional Resources for Carthage

For more information on Carthage or How to set up the Cartfile in the Cartfile page.