Difference between revisions of "Digital Measurement iOS Artifactory Guide"

From Engineering Client Portal

(Created page with "__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. == How to install...")
 
Line 50: Line 50:
 
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.**
  
Line 55: Line 56:
 
pod init
 
pod init
 
</syntaxhighlight>
 
</syntaxhighlight>
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. (If requesting a specific version number, use the  ‘~>’ sign to retrieve). 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 ====
 
==== Objective C ====
  
Line 67: Line 68:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
<blockquote> If requesting a specific version number, use the ‘~>’ sign to retrieve. </blockquote>
+
==== Swift ====
 +
 
 +
If your pod has '''use_frameworks!''' and you are developing in Swift, please use the following:
  
==== Swift ====
+
<syntaxhighlight lang=javascript>
If your pod has "use_frameworks!" and you are developing in Swift, please use the following:
 
<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, '11.0'
Line 96: Line 97:
 
end
 
end
  
 +
</syntaxhighlight>
 +
<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>
 
</syntaxhighlight>
  
 +
=== 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>
 
pod install
 
pod install
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
<br>
 
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.
 
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.
  

Revision as of 21:26, 4 February 2019

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.

Initial Configuration

The Nielsen SDK integration requires Cocoapods 1.4.0. or higher. The full installation guide for this framework is provided on the Getting Started page. 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

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:

Objective C

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

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

Swift

If your pod has use_frameworks! and you are developing in Swift, please use the following:

# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'
source 'https://github.com/NielsenDigitalSDK/nielsenappsdk-ios-specs.git'

target 'YourProjectsNameHere' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
    #Pods for ApplicationTarget
    pod 'NielsenAppSDK'

static_frameworks = ['NielsenAppSDK']
# make all the other frameworks into static frameworks by overriding the static_framework? function to return true
pre_install do |installer|
    installer.pod_targets.each do |pod|
        if static_frameworks.include?(pod.name)
            puts "Overriding the static_framework? method for #{pod.name}"
            def pod.static_framework?;
            true
            end
        end
    end
end
end


An example Podfile without use_frameworks!:

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

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:

  • 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.