Prerequisites:
- iOS 9+
- Xcode 14+
For iOS, note that a properly functioning integration cannot be made without following our documentation. Skipping over important steps to immediately download the SDK results in a much more difficult integration and poor performance of any integration built.
As such, it is recommended to thoroughly review the documentation and follow the instructions prior to downloading the DT SDK.
Step 1: Integrating the SDK in your App
DT supports both CocoaPods and manual download to integrate our SDK:
See the CocoaPods Getting Started and Using CocoaPods for more information.
Add the following pod:
pod 'FyberSDK', '~> 9.2.6'
Now you may start the SDK, refer to either Objective-C or Swift instructions below.
Installing the SDK
-
Download the latest version of the DT SDK. Feel free to check the changelog.
-
Drag the
fyber-sdk-lib
folder from a Finder window to your project’s Xcode window. You'll find this folder in the previously downloaded zip. -
Xcode will display a popup, prompting for more details about what to do with the dropped folder. Make sure that Create groups is checked as well as your application's target in the Add to targets section:
Make sure the static library is listed in the Link Binary with Libraries section of your target’s Build Phases.
- Xcode 5 build with modules is enabled by default. You can check this in the project Build Settings Panel. Search for “Module” and verify if
Enable Modules (C and Objective-C)
is set to Yes. Based on that, select one of the following options:
Adding a Bridging Header (Swift only)
- Next, in your project create a header called
YOUR_PROJECT-Bridging-Header.h
that imports theFyberSDK
header.
- Configure your project to use the bridging header you just created. For this go to the setting of your application’s target and set the
Objective-C Bridging Header
to where the header is located.
Important
Once you have downloaded and opened the SDK package, included is the DT Sample App which provides you basic usage of the DT SDK. For more details on the DT Sample App, click here.
Step2: Adding User Consent
GDPR
The General Data Protection Regulation requires you to scope your user's consent. A user is within the GDPR scope for your app when one or all of the following apply:
- The user is currently located in the EU
- The user has registered with the app as an EU resident
- The app is specifically targeted to EU users
Once you have collected the user’s consent, you can pass it onto the SDK using the following API:
BOOL userConsent = ...;
[[FyberSDK instance].user setGDPRConsent:userConsent];
let userConsent = ...
FyberSDK.instance().user.setGDPRConsent(userConsent)
userConsent
should be Yes if you have the user’s consent, or No otherwise.
If you don’t pass the user’s consent to the SDK, only contextual ads will be shown to that user.
We recommend that the first time you gather the user’s consent, you pass it onto the SDK before starting the SDK. The SDK will then take the user’s consent into consideration when initializing. In the following sessions, you will only need to call the API if the user updates his or her consent.
More information on GDPR can be found under the GDPR Resource Page and FAQs.
For details of the CCPA - Privacy String, click here.
CCPA - Privacy String
The intention of the California Consumer Privacy Act of 2018 (CCPA) is to protect the personal information of California residents. CCPA applies to all companies doing business in California. If a California resident uses an app developer’s mobile app, CCPA applies to the developer and every company that processes the personal information of the app’s users.
CCPA came into effect on 1 January 2020.
For more information on DT and CCPA, refer to DT’s Resource Page.
For more information about CCPA, refer to the IAB CCPA Compliance Framework.
Setting the IAB US Privacy String
We recommend that the first time you gather a user opt-out (aka 'consent'), you pass it onto the SDK before initializing it. The SDK takes the user opt-out into consideration when initializing.
Once you have collected the user’s opt-out, you can pass it onto the SDK using the following API:
To set the IAB US privacy string, use the following API:
[[FyberSDK instance].user setIABUSPrivacyString:@"1YNN"];
let privacyString = ...
FyberSDK.instance().user.setIABUSPrivacyString(privacyString)
Clearing Privacy Opt-Out
To clear the user opt-out setting, use the following API:
[[FyberSDK instance].user clearIABUSPrivacyString];
FyberSDK.instance().user.clearIABUSPrivacyString();
Step 3: Starting the SDK
Start the DT SDK before using any DT product.
Warning
You must initialize the SDK on app start for accurate DAU calculations.
To do this, determine a point in your application’s code that is run once. A good example point is the application:didFinishLaunchingWithOptions:
method in your application delegate.
#import "FyberSDK.h"
FYBSDKOptions *options = [FYBSDKOptions optionsWithAppId:@"00000"
userId:@"userId"
securityToken:@"000000000000000000000000"];
[FyberSDK startWithOptions:options];
let options = FYBSDKOptions(appId: "00000", userId: "userId", securityToken: "000000000000000000000000")
FyberSDK.start(with: options)
The Security Token
and appId
are required, and can be found in the Settings of your app in the Dashboard. The User ID
should uniquely identify the user of your app.
Note
Check that the userID is not hardcoded and is completely unique for each user.
An Alternate Option
The previous method is our preferred method of starting the SDK.
If you do not want to set a userId
yourself and prefer that the DT SDK creates it for you, the DT SDK can do so when you include the following in your code:
FYBSDKOptions *options = [FYBSDKOptions optionsWithAppId:@"00000"
securityToken:@"000000000000000000000000"];
[FyberSDK startWithOptions:options];
let options = FYBSDKOptions(appId: "00000", securityToken: "000000000000000000000000")
FyberSDK.start(with: options)
This generates the required unique userId
on the first launch of the application and stores it for subsequent launches.
Subsequent usage of the DT SDK during your application's lifecycle reuses the parameters passed to this call. If the user re-installs the app, a new userId
is generated.
Using optionsWithAppId:securityToken
is not DT's preferred method to start the SDK, especially if you are planning to user server-side callbacks to handle the user rewarding.