# Native TvOS

### Contents

* [1 Pokkt SDK for tvOS (v4.0) Integration Guide](broken://pages/I33nAKybuVsSoqlK3l5n)
* [2 Getting Started with Pokkt SDK v4.0](broken://pages/I33nAKybuVsSoqlK3l5n)
  * [2.1 Pokkt SDK for tvOS Integration Guide v4.0](broken://pages/I33nAKybuVsSoqlK3l5n)
    * [2.1.1 Overview](broken://pages/I33nAKybuVsSoqlK3l5n)
  * [2.2 Project Configuration](broken://pages/I33nAKybuVsSoqlK3l5n)
    * [2.2.1 Dependencies](broken://pages/I33nAKybuVsSoqlK3l5n)
  * [2.3 Implementation Steps.](broken://pages/I33nAKybuVsSoqlK3l5n)
    * [2.3.1 SDK Configuration](broken://pages/I33nAKybuVsSoqlK3l5n)
    * [2.3.2 Ad Types](broken://pages/I33nAKybuVsSoqlK3l5n)
      * [2.3.2.1 Video](broken://pages/I33nAKybuVsSoqlK3l5n)
      * [2.3.2.2 Rewarded](broken://pages/I33nAKybuVsSoqlK3l5n)
      * [2.3.2.3 Non Rewarded](broken://pages/I33nAKybuVsSoqlK3l5n)
    * [2.3.3 Ad Delegates](broken://pages/I33nAKybuVsSoqlK3l5n)
      * [2.3.3.1 Video](broken://pages/I33nAKybuVsSoqlK3l5n)
    * [2.3.4 OutStream Ads](broken://pages/I33nAKybuVsSoqlK3l5n)
    * [2.3.5 Pokkt ad player configuration](broken://pages/I33nAKybuVsSoqlK3l5n)
    * [2.3.6 User Details](broken://pages/I33nAKybuVsSoqlK3l5n)
    * [2.3.7 Debugging](broken://pages/I33nAKybuVsSoqlK3l5n)
    * [2.3.8 Analytics](broken://pages/I33nAKybuVsSoqlK3l5n)
      * [2.3.8.1 Google Analytics](broken://pages/I33nAKybuVsSoqlK3l5n)
      * [2.3.8.2 Flurry Analytics](broken://pages/I33nAKybuVsSoqlK3l5n)
      * [2.3.8.3 MixPanel Analytics](broken://pages/I33nAKybuVsSoqlK3l5n)
      * [2.3.8.4 Fabric Analytics](broken://pages/I33nAKybuVsSoqlK3l5n)
    * [2.3.9 IAP(In App Purchase)](broken://pages/I33nAKybuVsSoqlK3l5n)
    * [2.3.10 Limitation](broken://pages/I33nAKybuVsSoqlK3l5n)

### Pokkt SDK for tvOS (v4.0) Integration Guide

Last Update: 11th February, 2019

Download Latest Version Here with PDF Documentation v4.0.

***

### Getting Started with Pokkt SDK v4.0

1\. Add *"PokktSDK.framework"* to your project.

2\. Set *Application Id* and *Security Key* in Pokkt SDK. You can get it from Pokkt dashboard from your account. These are unique per app registered.

```
[PokktAds setPokktConfigWithAppId:(NSString*)appId
securityKey:(NSString*)securityKey];
```

3\. Set the following to enable or disable omission of Pokkt logs and other informatory messages. Make sure to set it to false before release.

```
[PokktDebugger setDebug:[YES/NO]];
```

4\. Show Video Ad with one of the followings:

```
[PokktVideoAds showRewardedVideoAd:(NSString*) screenName
viewController:(UIViewController *)viewController];
[PokktVideoAds showNonRewardedVideoAd:(NSString*) screenName
viewController:(UIViewController *)viewController];
```

5\. Implement *\[PokktVideoAdsDelegate setPokktVideoAdsDelegate:]* to listen to video-ad related messages.

***

#### Pokkt SDK for tvOS Integration Guide v4.0

**Overview**

Thank you for choosing Pokkt SDK for iOS. This document contains all the information required to set up the SDK with your project. Before implementing it is mandatory to go through project configuration and implementation steps , as these sections contain mandatory steps for basic SDK integration.

You can download our SDK from pokkt.com.

In the package downloaded above you will find::

1. Docs
   * Contains documentations for step wise step integration for SDK.
2. PokktAds Demo
   * Source code for *PokktAds Demo*(Sample app) which showcase implementation of Pokkt SDK through code for better understanding.
3. PokktSDK
   * *PokktSDK.framework* add in to your project

ScreenName: This one parameter is accepted by almost all API’s of Pokkt SDK. This controls the placement of ads and can be created on Pokkt Dashboard.

We will be referencing PokktAds Demo app provided with SDK during the course of explanation in this document. We suggest you go through the sample app for better understanding.

#### Project Configuration

**Dependencies**

* Add PokktSDK.framework to your project’s settings at “Build Phases -> Link Binary with Libraries and add the PokktSDK.framework.

Frameworks Required

```
CoreData.framework
Foundation.framework
MediaPlayer.framework
SystemConfiguration.framework
UIKit.framework
CoreTelephony.framework
EventKit.framework
AdSupport.framework
CoreGraphics.framework
CoreMotion.framework
MessageUI.framework
EventKitUI.framework
CoreLocation.framework
AVFoundation.framework
libc++.tbd
```

Info.plist

Add the below exceptions to your application’s info.plist.

```
<key>NSAppTransportSecurity</key>
<dict>
   <key>NSExceptionDomains</key>
   <dict>
      <key>pokkt.com</key>
      <dict>
         <key>NSIncludesSubdomains</key>
         <true/>
         <key>NSExceptionAllowsInsecureHTTPLoads</key>
         <true/>
         <key>NSExceptionRequiresForwardSecrecy</key>
         <false/>
         <key>NSExceptionMinimumTLSVersion</key>
         <string>TLSv1.2</string>
         <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
         <false/>
         <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
         <true/>
         <key>NSThirdPartyExceptionMinimumTLSVersion</key>
         <string>TLSv1.2</string>
         <key>NSRequiresCertificateTransparency</key>
         <false/>
      </dict>
      <key>cloudfront.net</key>
      <dict>
         <key>NSIncludesSubdomains</key>
         <true/>
         <key>NSExceptionAllowsInsecureHTTPLoads</key>
         <true/>
         <key>NSExceptionRequiresForwardSecrecy</key>
         <false/>
         <key>NSExceptionMinimumTLSVersion</key>
         <string>TLSv1.2</string>
         <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
         <false/>
         <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
         <true/>
         <key>NSThirdPartyExceptionMinimumTLSVersion</key>
         <string>TLSv1.2</string>
         <key>NSRequiresCertificateTransparency</key>
         <false/>
      </dict>
   </dict>
</dict>
```

Other Settings

* Please make sure that your app project has *-ObjC* set as Other linker flag in Build Settings.

***

#### Implementation Steps.

**SDK Configuration**

1\. Set Application Id and Security key in Pokkt SDK. You can get it from Pokkt dashboard from your account. We generally assign unique application Id and Security key.

```
PokktAds.setPokktConfigWithAppId:(NSString*) appId securityKey:(NSString*)securityKey
```

2\. If you are using server to server integration with Pokkt, you can also set Third Party UserId in PokktAds.

```
PokktAds.setThirdPartyUserId:(NSString*) userId
```

3\. When your application is under development and if you want to see Pokkt logs and other informatory messages, you can enable it by setting shouldDebug to true . Make sure to disable debugging before release.

```
[PokktDebugger setDebug: YES/ NO];
```

**Ad Types**

**Video**

* Video ad can be rewarded or non-rewarded. You can directly call show for it.
* it will stream the video which may lead to buffering delays depending on the network connection.

**Rewarded**

1. To show rewarded ad call:

   ```
   [PokktVideoAds showRewardedVideoAd:(NSString*) screenName viewController:(UIViewController *)viewController];
   ```

**Non Rewarded**

1. To show non-rewarded ad call:

   ```
   [PokktVideoAds showNonRewardedVideoAd:(NSString*) screenName viewController:(UIViewController *)viewController];
   ```

**Ad Delegates**

Ad actions are optional, but we suggest to implement them as it will help you to keep track of the status of your ad request.

**Video**

```
[PokktVideoAdsDelegate setPokktVideoAdsDelegate:self];
```

**OutStream Ads**

1. OutStream ad will be non-rewarded only.
2. Ad will play only if Ad is visible in bound, if it is not visible on the screen it will in pause state.
3. OutStream Ad contain 3 states as Play, Pause & Replay. After completing the video Replay button will be enable.
4. If You are requesting for full screen ad then you have to destroy OutStream ad.
5. OutStream Ad allows only for the following format.
   * ScrollView
     1. Load OutStream Ad Call:<br>

        ```
        +(void)loadOutstreamAd:(NSString*) screenName placeHolder:(UIView *)container scrollView:(UIScrollView *)scrollView withDelegate: (PokktOutStreamsAdsDelegate*) delegate
        ```
     2. Destroy OutStream Ad Call:<br>

        ```
        +(void)disappearScrollViewOutStreamAd:(NSString *)screenName inContainer:(UIView *)container
        ```
   * Tableview
     1. Load Ad<br>

        ```
        +(void)loadOutstreamAd:(NSString*) screenName atIndexPath:(NSIndexPath*)indexPath tableView:(UITableView *)tableView withDelegate:(PokktOutStreamsAdsDelegate*) delegate
        ```
     2. Destroy Ad<br>

        ```
        +(void)disappearTableViewOutStreamAd:(NSString *)screenName inContainer:(UITableView *)tableView
        ```

**Pokkt ad player configuration**

Pokkt Ad player works the way App is configured at Pokkt dashboard, but we provide a way to override those settings using PokktAdPlayerViewConfig.

Application should prefer configuration provided through code by developer or what’s configured for the app in dashboard, can be controlled any time through the dashboard itself. If you want to make changes to this configuration after your app distribution, you can contact Pokkt Team to do the same for your app through admin console.

```
PokktAdPlayerViewConfig * adPlayerViewConfig = [[PokktAdPlayerViewConfig alloc] init];
// set properties values to adPlayerViewConfig
PokktAds.setAdPlayerViewConfig(adPlayerViewConfig );
```

Various properties that can be managed through this are:

1\. Default skip time\
Defines the time after which user can skip the Ad.\
Property name: DefaultSkipTime\
Values:\
Any Integer value.\
Default value is 10 seconds.<br>

2\. Should allow skip\
Defines if user is allowed to skip the Ad or not.\
Property name: ShouldAllowSkip\
Values:\
True = User can skip Ad.\
False = User can’t skip Ad.<br>

3\. Should allow mute\
Defines if user is allowed to mute the Video Ad or not.\
Property name: ShouldAllowMute\
Values:\
True = User can mute video Ad.\
False = User can’t mute video Ad.<br>

4\. Should confirm skip\
Defines if confirmation dialog is to be shown before skipping the Ad.\
Property name: ShouldConfirmSkip\
Values:\
True = Confirmation dialog will be shown before skipping the video.\
False = Confirmation dialog will not be shown before skipping the video.<br>

5\. Skip confirmation message\
Defines what confirmation message to be shown in skip dialog.\
Property name: SkipConfirmMessage\
Values:\
Any String message.\
Default value is “Skipping this video will earn you NO rewards. Are you sure?”.<br>

6\. Affirmative label for skip dialog\
Defines what should be the label for affirmative button in skip dialog.\
Property name: SkipConfirmYesLabel\
Values:\
Any String message.\
Default value is “Yes”.<br>

7\. Negative label for skip dialog\
Defines what should be the label for affirmative button in skip dialog.\
Property name: SkipConfirmNoLabel\
Values:\
Any String message.\
Default value is “No”.<br>

8\. Skip timer message\
Defines message to be shown before enabling skip button. Don’t forget to add placeholder “ ## ” in your custom message. This placeholder is replaced by property “Default skip time” assigned above.\
Property name: setSkipTimerMessage\
Values:\
Any String message.\
Default value is “You can skip video in ## seconds”<br>

9\. Incentive message\
Defines message to be shown during video progress, that after what time user will be incentivised.\
Property name: setIncentiveMessage\
Values:\
Any String message\
Default value is “more seconds only for your reward !”<br>

10\. Should collect feedback\
Defines message to be shown during video progress, that after what time user will be incentivised.\
Property name setShouldCollectFeedback\
Values:\
True = If you want to collect feedback from the user for the Ad.\
False = If you don’t want to collect feedback from the user for the Ad.

**User Details**

For better targeting of ads you can also provide user details to our SDK using.

```
PokktUserDetails *pokktUserDetails = [PokktUserDetails alloc] init];
pokktUserDetails.Name = "";
pokktUserDetails.Age = "";
pokktUserDetails.Sex = "";
pokktUserDetails.MobileNo = "";
pokktUserDetails.EmailAddress = "";
pokktUserDetails.Location = "";
pokktUserDetails.Birthday = "";
pokktUserDetails.MaritalStatus = "";
pokktUserDetails.FacebookId = "";
pokktUserDetails.TwitterHandle = "";
pokktUserDetails.Education = "";
pokktUserDetails.Nationality = "";
pokktUserDetails.Employment = "";
pokktUserDetails.MaturityRating = "";
[PokktAds setPokktUserDetails: pokktUserDetails]
```

**Debugging**

Other than enabling debugging for Pokkt SDK, it can also be used to:

**Analytics**

We support various analytics in Pokkt SDK.

Below is mentioned how to enable various analytics with Pokkt SDK.

**Google Analytics**

Google analytics Id can be obtained from Google dashboard.

```
PokktAnalyticsDetails *analyticsDetail = [[PokktAnalyticsDetails alloc] init];
analyticsDetail.eventType = GOOGLE_ANALYTICS;
analyticsDetail.googleTrackerID = @"xyz";
[PokktAds setPokktAnalyticsDetail:analyticsDetail];
```

**Flurry Analytics**

Flurry application key can be obtained from Flurry dashboard.

```
PokktAnalyticsDetails *analyticsDetail = [[PokktAnalyticsDetails alloc] init];
analyticsDetail.eventType = FLURRY_ANALYTICS;
analyticsDetail.flurryTrackerID = @"xyz";
[PokktAds setPokktAnalyticsDetail:analyticsDetail];
```

**MixPanel Analytics**

MixPanel project token can be obtained from MixPanel dashboard.

```
PokktAnalyticsDetails *analyticsDetail = [[PokktAnalyticsDetails alloc] init];
analyticsDetail.eventType = MIXPANNEL_ANALYTICS;
analyticsDetail.mixPanelTrackerID = @"xyz";
[PokktAds setPokktAnalyticsDetail:analyticsDetail];
```

**Fabric Analytics**

Analytics Id is not required in case of Fabric.

```
PokktAnalyticsDetails *analyticsDetail = [[PokktAnalyticsDetails alloc] init];
analyticsDetail.eventType = FABRIC_ANALYTICS;
analyticsDetail.fabricTrackerID = @"xyz";
[PokktAds setPokktAnalyticsDetail:analyticsDetail];
```

**IAP(In App Purchase)**

Call trackIAP to send any In App purchase information to Pokkt.

```
InAppPurchaseDetails * inAppPurchaseDetails = [ InAppPurchaseDetails alloc]init];
inAppPurchaseDetails.ProductId = "<productId>";
inAppPurchaseDetails.PurchaseData = "<purchaseData>";
inAppPurchaseDetails.PurchaseSignature = "<purchaseSignature>";
inAppPurchaseDetails.PurchaseStore = IAPStoreType.GOOGLE;
inAppPurchaseDetails.Price = <100.00>;
[PokktAds trackIAP: inAppPurchaseDetails]
```

**Limitation**

* Any web-enabled ad content is not supported, such as MRAID/VPAID/HTML ads etc.
* Currently caching for video/images is not possible.
* There is no close-button for video, start & end cards.
* No mute-button for video ads.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.pokkt.com/pokkt-sdk-plugins/native-tvos.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
