initWithAppInfo:delegate:

From Engineering Client Portal

Revision as of 00:12, 11 May 2019 by Admin (talk | contribs)

Engineering Portal / Digital / iOS SDK API Reference / initWithAppInfo:delegate:

Syntax

 (instancetype)initWithAppInfo:(id)appInfo delegate:(id)delegate;

Here, appInfo is a JSON formatted string or NSDictionary object that includes identification of the app.

Init JSON

  • Call initWithAppInfo:delegate: to initialize a Nielsen App SDK object.
    • This API requires Core Location service.
  • The compelte list of arguments that can be passed via the AppInfo JSON schema for the API are as follows.
    • The appid is provided by the Nielsen Technical Account Manager (TAM). The appid is a GUID data type and is specific to the application.
Parameter / Argument Description Source Required? Example
appid Unique id for the application assigned by Nielsen. It is GUID data type.
  • Use Test appid during development, test, and certification processes
  • Use Production appid to submit app to App / Play store, after receiving Nielsen certification.
Nielsen-specified Yes PXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
appname Name of the application Client-defined Yes Nielsen Sample App
appversion Current version of the app used SDK generated Yes "1.0.2"
sfcode Nielsen collection facility to which the SDK should connect.

DTVR

  • "us" for production

Digital Audio

  • "drm" for production

DCR

  • "dcr" for production
Nielsen-specified Yes dcr
longitude This value will not be overwritten by SDK for International (Germany). Client-defined No 123.22
latitude This value will not be overwritten by SDK for International (Germany). Client-defined No -123.22
dma Nielsen Designated Market Area code. DMA must be the Nielsen DMA value. Please check with the Technical Account Manager. Client-defined No 123
ccode If Country Code is provided by the app, it should be done after consultation with the Technical Account Manager. Client-defined No 456

Return Values

The application should check for valid return values like:

  • Initialized NielsenAppApi object of type id.
  • NIL object, if the initialization failed

Note: The minimum version supported by SDK is iOS 7. The app may not compile or the call to initWithAppInfo:delegate: will fail if Nielsen App SDK is initialized on devices with iOS versions 6.x and earlier.

Debug flag for development environment

Player application developers / integrators can use Debug flag to check whether an App SDK API call made is successful. To activate the Debug flag,

  • Pass the argument @"nol_devDebug":@"INFO", in the JSON string for initWithAppInfo:delegate:, as below. The permitted values are
    • INFO: Displays the API calls and the input data from the application (validate player name, app ID, etc.). It can be used as certification Aid.
    • WARNING: Indicates potential integration / configuration errors or SDK issues.
    • ERROR: Indicates important integration errors or non-recoverable SDK issues.
    • DEBUG: Debug logs, used by the developers to debug more complex issues.

Example

NSDictionary* appInformation = @
         {
            @"appid": @"appid",
            @"appname": @"appname",
            @"appversion": @"2.0"
            @"sfcode": @"sfcode",
            @"nol_devDebug": @"INFO"
         };
nlsAppApiMeter = [[NielsenAppApi alloc] initWithAppInfo:appInformation delegate:self];

Once the flag is active, it logs each API call made and the data passed. The log created by this flag is minimal.

Note: DO NOT activate the Debug flag in a production environment.

Sequence Diagram

Sequence-video-radio.jpg

Examples

SDK init JSON call Example
JSON with basic application information
NSDictionary *appInformation = @
{
   @"sfcode": @"dcr",
   @"appid": @"PXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
   @"appname": @"Nielsen SDK Sample QA",
   @"appversion": @"2.0"
}
JSON with optional Longitude and Latitude
NSDictionary *appInformation = @
{
   @"sfcode": @"dcr",
   @"appid": @"PXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
   @"appname": @"Nielsen SDK Sample QA",
   @"appversion": @"2.0"
   @"longitude": @"123.22",
   @"latitude": @"-223.32",
   @"dma": @"123",
   @"ccode": @"456"
}