Getting started on iOS
This page explains how to install the Smart Instream SDK into an iOS application. This is the first step to complete before delivering instream ads in your video content.
Prerequisites
There are some prerequisites before installing the instream SDK.
- You use Xcode 14.0 or higher.
- Your app targets iOS 11.0 or higher for iOS apps, or tvOS 12.0 or higher for tvOS apps.
- You installed
Cocoapods
on your computer.
App Tracking Transparency & IDFA
Starting with iOS 14, your application will have to ask for consent before tracking the user. This request for consent can be made through the use of the App Tracking Transparency framework.
The Smart Instream SDK makes use of the device IDFA during ad calls and will retrieve it automatically if your app have requested tracking consent (and if the user has accepted). If no user consent is available or if the user denied the request, the SDK will use a transient ID instead.
To keep access to the IDFA on iOS 14 devices, you must implement the App Tracking Transparency framework in your app. You can find more information about this integration in our samples or in Apple's official documentation.
Note that requesting user consent using the App Tracking Transparency framework does not guarantee that your app is compliant with local privacy laws (including GDPR, CCPA, …). Check the relevant page for more info.
More info about the transient ID:
- it is not shared accross apps (even from the same publisher),
- it is reset every 24 hours,
- it is only used for technical purposes (e.g. capping, fraud detection).
You can disable the transient ID completely using transientIDEnabled
on SVSConfiguration
.
App Transport Security
App Transport Security (ATS) is a feature to protect user privacy introduced in iOS 9. ATS will block every non HTTPS connections. It is enabled by default for iOS applications and enforces secure connections.
Eventhough the ad industry tends to full HTTPS support, it happens that some medias are not hosted on secured servers. To avoid your video ads being blocked by ATS you should configure exceptions in your app's Info.plist file.
Under App Transport Security Settings
of your Info.plist, make sure you enable the exceptions for:
Allow Arbitrary Loads
andAllow Arbitrary Loads For Media
Your Info.plist should contains these keys:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsForMedia</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
The NSAllowsArbitraryLoads
exception is required to make sure your ads will not be blocked by ATS on iOS 9 whereas NSAllowsArbitraryLoadsForMedia
will make sure your ads are not blocked on devices with iOS 10 and higher.
Installation with Cocoapods
To import the Smart Instream SDK into your iOS project, please use Cocoapods.
CocoaPods is a dependency manager for Swift and Objective-C Xcode projects. You can read Cocoapods official documentation for information on how to setup Podfiles.
There is no dedicated TV SDK (aka Smart-Instream-TV-SDK) anymore for iOS starting with the SDK 7.20. The main SDK xcframework now supports both iOS & tvOS devices.
-
Add in your project's Podfile the following line:
pod 'Smart-Instream-SDK'
-
Open a terminal window and cd to your project's directory.
-
Then from the command line, run:
$ pod install --repo-update
This will install all the dependencies and frameworks required for the Smart Instream SDK to work.
-
You can now proceed with the integration of your ads directly within your project's workspace.