Difference between revisions of "Digital Measurement iOS Artifactory Guide"

From Engineering Client Portal

Line 1: Line 1:
 
{{Breadcrumb|}} {{Breadcrumb|Digital}} {{Breadcrumb|DCR & DTVR}} {{CurrentBreadcrumb}}
 
{{Breadcrumb|}} {{Breadcrumb|Digital}} {{Breadcrumb|DCR & DTVR}} {{CurrentBreadcrumb}}
 
[[Category:Digital]]
 
[[Category:Digital]]
 
 
__NOTOC__
 
__NOTOC__
 
The Nielsen AppSDK can either be downloaded directly or can be integrated directly within an application through the use of a CocoaPod or Gradle.
 
The Nielsen AppSDK can either be downloaded directly or can be integrated directly within an application through the use of a CocoaPod or Gradle.
  
== How to install Nielsen SDK in iOS  ==
+
= How to install Nielsen SDK in iOS  =
CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. It has over 30 thousand libraries and is used in over 1.9 million apps. The Nielsen SDK now uses this distribution framework for improved version management.  
+
CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. It has over 30 thousand libraries and is used in over 1.9 million apps. The Nielsen SDK now uses this distribution framework for improved version management and provides a Static and Dynamic Framework.
  
=== Initial Configuration ===
+
== Initial Configuration ==
The Nielsen SDK integration requires Cocoapods 1.4.0. or higher. The full installation guide for this framework is provided on the [https://guides.cocoapods.org/using/getting-started.html Getting Started] page. How to set up the Podfile is mentioned in [https://guides.cocoapods.org/using/using-cocoapods.html) Using Cocoapods] page.
+
The Nielsen SDK integration requires Cocoapods
 +
* The Dynamic Framework which requires Cocoapods Version 1.6 or higher.
 +
* The Static Framework requires Cocoapods version 1.4.0. or higher.
  
=== Repository Credentials ===
+
The full installation guide for this framework is provided on the [https://guides.cocoapods.org/using/getting-started.html Getting Started] page, and how to set up the Podfile is mentioned in [https://guides.cocoapods.org/using/using-cocoapods.html) Using Cocoapods] page.
 +
 
 +
== Repository Credentials ==
 
The first step is to add the credentials received from Nielsen into your .netrc file.
 
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
 
Navigate to your home folder and create a file called .netrc
Line 26: Line 29:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
=== Credentials ===
+
'''Your Credentials are:'''
Obtain credentials '''[[Digital Downloads| → here ←]]'''
+
<syntaxhighlight lang=Coffescript>
 +
machine raw.githubusercontent.com
 +
login NielsenSdkRepo
 +
password edec0d01b953171c704188c1d8fc0aa4217ec506
 +
</syntaxhighlight>
  
=== Verify version of Cocoapods ===
+
== Verify version of Cocoapods ==
 
First verify that Cocoapods is installed.
 
First verify that Cocoapods is installed.
 
<syntaxhighlight lang=Javascript>
 
<syntaxhighlight lang=Javascript>
Line 43: Line 50:
 
brew install cocoapods
 
brew install cocoapods
 
</syntaxhighlight>
 
</syntaxhighlight>
=== Add Cocoapod repository ===
+
== Add Cocoapod repository ==
 +
=== Dynamic Framework (Cocoapods 1.6+) ===
 +
If using '''Dynamic Framework''' (preferred approach), from the command line, type the following:
 +
<syntaxhighlight lang=Javascript>
 +
pod repo add https://github.com/NielsenDigitalSDK/nielsenappsdk-ios-specs-dynamic.git
 +
</syntaxhighlight>
 +
Make sure you run the pod init command in your **project's directory.**
 +
<syntaxhighlight lang=Javascript>
 +
pod init
 +
</syntaxhighlight>
 +
<br>You now need to slightly modify the PodFile that was created in this directory.  From the command line, you can use vi or vim to edit. <br> The following must be in the PodFile:
 +
==== Podfile ====
 +
<syntaxhighlight lang=Javascript>
 +
platform :ios, '8.0'
 +
source 'https://github.com/NielsenDigitalSDK/nielsenappsdk-ios-specs-dynamic.git'
 +
 
 +
target 'YourProjectsNameHere' do
 +
use_frameworks!
 +
    #Pods for ApplicationTarget
 +
    pod 'NielsenAppSDK'
 +
</syntaxhighlight>
 +
 
 +
=== For Static Framework (Cocoapods 1.4+) ===
 
From the command line, type the following:
 
From the command line, type the following:
 
<syntaxhighlight lang=Javascript>
 
<syntaxhighlight lang=Javascript>
 
pod repo add NielsenAppSDK https://github.com/nielsendigitalsdk/nielsenappsdk-ios-specs.git
 
pod repo add NielsenAppSDK https://github.com/nielsendigitalsdk/nielsenappsdk-ios-specs.git
 
</syntaxhighlight>
 
</syntaxhighlight>
<br>
 
 
Make sure you run the pod init command in your **project's directory.**
 
Make sure you run the pod init command in your **project's directory.**
 
 
<syntaxhighlight lang=Javascript>
 
<syntaxhighlight lang=Javascript>
 
pod init
 
pod init
 
</syntaxhighlight>
 
</syntaxhighlight>
 
<br>You now need to slightly modify the PodFile that was created in this directory.  From the command line, you can use vi or vim to edit. <br> The following must be in the PodFile:
 
<br>You now need to slightly modify the PodFile that was created in this directory.  From the command line, you can use vi or vim to edit. <br> The following must be in the PodFile:
==== Objective C ====
+
==== Podfile ====
 
 
 
<syntaxhighlight lang=Javascript>
 
<syntaxhighlight lang=Javascript>
platform :ios, '11.0'
+
platform :ios, '8.0'
 
source 'https://github.com/NielsenDigitalSDK/nielsenappsdk-ios-specs.git'
 
source 'https://github.com/NielsenDigitalSDK/nielsenappsdk-ios-specs.git'
  
Line 66: Line 92:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
==== Swift ====
+
<!--
 +
=== For Cocoapods Versions < 1.6.0 ===
  
If your pod has '''use_frameworks!''' and you are developing in Swift, please use the following:
+
If you are using a version of Cocoapods that is less than 1.6.0, you have a Swift Project and your pod has '''use_frameworks!''' please use the following:
  
 
<syntaxhighlight lang=javascript>
 
<syntaxhighlight lang=javascript>
 
# Uncomment the next line to define a global platform for your project
 
# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'
+
platform :ios, '8.0'
 
source 'https://github.com/NielsenDigitalSDK/nielsenappsdk-ios-specs.git'
 
source 'https://github.com/NielsenDigitalSDK/nielsenappsdk-ios-specs.git'
  
Line 97: Line 124:
 
</syntaxhighlight>
 
</syntaxhighlight>
 
<br>
 
<br>
An example Podfile without '''use_frameworks!:'''
+
-->
<syntaxhighlight lang=Javascript>
 
source 'https://github.com/NielsenDigitalSDK/nielsenappsdk-ios-specs.git'
 
platform :ios, '9.0'
 
target 'Application' do
 
# Uncomment the next line if you're using Swift
 
# or would like to use dynamic frameworks
 
# use_frameworks!
 
# Pods for Application
 
pod 'NielsenAppSDK'
 
end
 
</syntaxhighlight>
 
  
=== Execute Install ===
+
== Execute Install ==
 
Once that has been edited, you can now execute the install:
 
Once that has been edited, you can now execute the install:
 
<syntaxhighlight lang=Swift>
 
<syntaxhighlight lang=Swift>
Line 119: Line 135:
  
 
Open the file with the extension of <code>.xcworkspace</code> file using Xcode.
 
Open the file with the extension of <code>.xcworkspace</code> file using Xcode.
 +
<!--
 +
== Build Notes ==
 +
Please note that the Nielsen dynamic framework contains slices for devices and simulators.  When building your project it is recommended that Simulator slices are removed before sending the app to the AppStore.  An example of the shell script that should be added as a Run Script phase in the application is attached
 +
<syntaxhighlight lang=Swift>
 +
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
 +
 +
# This script loops through the frameworks embedded in the application and
 +
# removes unused architectures.
 +
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
 +
do
 +
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
 +
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
 +
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
 +
 +
EXTRACTED_ARCHS=()
 +
 +
for ARCH in $ARCHS
 +
do
 +
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
 +
lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
 +
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
 +
done
 +
 +
echo "Merging extracted architectures: ${ARCHS}"
 +
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
 +
rm "${EXTRACTED_ARCHS[@]}"
 +
 +
echo "Replacing original executable with thinned version"
 +
rm "$FRAMEWORK_EXECUTABLE_PATH"
 +
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"
 +
 +
done
 +
</syntaxhighlight>
 +
-->
  
 
== Pod Versions ==
 
== Pod Versions ==
 
The following Pod versions are now available:
 
The following Pod versions are now available:
 +
* NielsenAppSDK
 
* NielsenTVOSAppSDK  
 
* NielsenTVOSAppSDK  
 
* VRIAppSDK  
 
* VRIAppSDK  

Revision as of 21:04, 26 February 2019

Engineering Portal breadcrumbArrow.png Digital breadcrumbArrow.png DCR & DTVR breadcrumbArrow.png Digital Measurement iOS Artifactory Guide

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

How to install Nielsen SDK in iOS

CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. It has over 30 thousand libraries and is used in over 1.9 million apps. The Nielsen SDK now uses this distribution framework for improved version management and provides a Static and Dynamic Framework.

Initial Configuration

The Nielsen SDK integration requires Cocoapods.

  • The Dynamic Framework which requires Cocoapods Version 1.6 or higher.
  • The Static Framework requires Cocoapods version 1.4.0. or higher.

The full installation guide for this framework is provided on the Getting Started page, and how to set up the Podfile is mentioned in Using Cocoapods 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:

machine raw.githubusercontent.com
login <Nielsen App SDK client>
password <Auth token>

Your Credentials are:

machine raw.githubusercontent.com
login NielsenSdkRepo
password edec0d01b953171c704188c1d8fc0aa4217ec506

Verify version of Cocoapods

First verify that Cocoapods is installed.

pod --version

If it is not, then install.

Install via gem
sudo gem install cocoapods
Install using homebrew
brew install cocoapods

Add Cocoapod repository

Dynamic Framework (Cocoapods 1.6+)

If using Dynamic Framework (preferred approach), from the command line, type the following:

pod repo add https://github.com/NielsenDigitalSDK/nielsenappsdk-ios-specs-dynamic.git

Make sure you run the pod init command in your **project's directory.**

pod init


You now need to slightly modify the PodFile that was created in this directory. From the command line, you can use vi or vim to edit.
The following must be in the PodFile:

Podfile

platform :ios, '8.0'
source 'https://github.com/NielsenDigitalSDK/nielsenappsdk-ios-specs-dynamic.git'

target 'YourProjectsNameHere' do
 use_frameworks!
    #Pods for ApplicationTarget
    pod 'NielsenAppSDK'

For Static Framework (Cocoapods 1.4+)

From the command line, type the following:

pod repo add NielsenAppSDK https://github.com/nielsendigitalsdk/nielsenappsdk-ios-specs.git

Make sure you run the pod init command in your **project's directory.**

pod init


You now need to slightly modify the PodFile that was created in this directory. From the command line, you can use vi or vim to edit.
The following must be in the PodFile:

Podfile

platform :ios, '8.0'
source 'https://github.com/NielsenDigitalSDK/nielsenappsdk-ios-specs.git'

target 'YourProjectsNameHere' do
    #Pods for ApplicationTarget
    pod 'NielsenAppSDK'


Execute Install

Once that has been edited, you can now execute the install:

pod install


Cocoapods will automatically create a new file with extension “.xcworkspace”. From this moment, that file should be used for using the target project instead of previous one with extension “.xcodeproj”. Inside of this workspace you will see “Pods” target which will include ready to use NielsenAppApi framework.

Open the file with the extension of .xcworkspace file using Xcode.

Pod Versions

The following Pod versions are now available:

  • NielsenAppSDK
  • NielsenTVOSAppSDK
  • VRIAppSDK

Regional Builds

  • NielsenAGFAppSDK
  • NielsenAGFTVOSAppSDK
  • NielsenAGFNoAdAppSDK
  • NielsenAGFNoAdTVOSAppSDK


Additional Resources

For more information on CocoaPods or How to set up the Profile in the Using Cocoapods page.