Integrating with Cocoapods
Follow these steps to integrate via Cocoapods:
- Open a terminal.
- Navigate to your project folder.
- Create an empty pod file:
Ruby
touch 'Podfile'
- Edit the pod file:
Ruby
nano Podfile
- Add the following lines and substitute the
<YOUR TARGET>
with the real one:
Ruby
target '' do
pod 'Fyber_Marketplace_SDK'
end
- Save and exit using Ctrl+O -> Enter -> Ctrl+X
- Run install:
Ruby
pod install
-
After the pods have been installed, the ongoing work with Xcode should happen via its workspace file and not project file.
-
Import the IASDKCore into the AppDelegate class:
Objective-C
#import <IASDKCore/IASDKCore.h>
Troubleshooting
OTHER_LDFLAGS
build setting defined in ...- Add the
$(inherited)
flag to theOther Linker Flags
.
- Run
pod update
, it will update the locally cached pods and will link everything in the Xcode workspace.
Partial Installs
If you need only particular Fyber Marketplace modules, you can install these particular modules by specifying them.
Note
The IASDKCore module is mandatory.
Ruby
target '' do
pod 'Fyber_Marketplace_SDK/IASDKCore'
pod 'Fyber_Marketplace_SDK/IASDKMRAID'
end
Downloading the SDK
To download the Marketplace iOS SDK, follow these steps:
- Go to Revenue Desk and sign-in
- On the left menu bar select SDKs
- Under iOS, click Download.
Note
The Fyber Marketplace SDK Zip folder contains a test app that publishers can use for reference on how to integrate the SDK, how ads from Marketplace appear or to troubleshoot issues.
Starting the Process
Before you begin the integration process, the first step is to choose your:
Integrating the iOS SDK begins when you decide which of the modules you want to integrate.
Choose from the following:
- IASDKCore (Required for all)
- IASDKMRAID (HTML/MRAID content)
- IASDKVideo (VAST/VPAID content)
To understand more about Fyber modules, click here.
Note
- If you are using the Cocoapods Dependency Manager, click here, afterwards you can immediately skip to Step 2.
- The Fyber iOS SDK requires, at minimum, an iOS 9.0 target and is fully compliant with iOS 13.
Unity Wrapper
In addition to the native Android and iOS SDKs, the Marketplace SDK supplies a unity wrapping package, which can be used to import the Marketplace SDKs into a Unity project.
The Marketplace Unity wrapper package is built upon the Google Unity jar Resolver. It works by adding the native Android/iOS dependencies to the exported native projects made at Unity run time.
To use the Unity Wrapper, download the relevant unitypackage file and import it into your project.
Note
Currently, the Marketplace Unity package does not provide any Unity bridging for requesting ads using Unity APIs.
Step 1: Integrating the Modules
- Drag the desired modules to your project.
- Xcode displays a popup, asking for more details about what to do with the dropped folder.
Make sure that the Copy items if needed and Create Groups is selected in your application's target in the Add to targets section.
- Link the app target with the IASDKCore Module by clicking your application target -> Build Phases -> Link Binary With Libraries.
Expand this window.
- Drag the IASDKCore framework to the Link Binary With Libraries section.
This links your project with IASDKCore module and adds a required path to the Framework Search Paths.
- Once this is completed, repeat the process for any other added IASDK Module (Video, MRAID, Native).
- Add the Resources Bundle. To do this:
- Return to the Build Phases section
- Click and expand the Copy Bundle Resources section
- Drag the IASDKResources.bundle there.
- Add the
libxml2.2.tbd
lib to the target by clicking the application target -> Build Phases -> Link Binary With Libraries.
Once there, enter libxml2.2tbd
, and click Add.
- Declare the
-ObjC
flag in the project by going to the application target -> Build Settings -> Other Linker Flags.
Once there, click add new (+), and enter -ObjC
.
- Click Enter.
Note
If your IASDK folders are physically located outside of your Xcode Project and were not copied at integration, you must provide a Framework Search Path. To do this, select your application target >> Build Settings >> Framework Search Paths.
Click add new (+), and type in the location of the IASDK Modules on your local workspace (e.g: ~/Downloads/IASDK-Publishers). Once complete, click Enter to define it as recursive, and close the window.
- Import the IASDK into the AppDelegate class:
Importing the IASDK
#import <IASDKCore/IASDKCore.h>
Step 2: Intitializing the SDK
Add the the following line of code inside the method of the AppDelegate class:
application:didFinishLaunchingWithOptions:launchOptions
Initializing the SDK
[IASDKCore.sharedInstance initWithAppID:@"YOUR APP ID"
completionBlock:^(BOOL success, NSError * _Nullable error) {}
completionQueue:nil];
For details of advanced SDK init integration, click here.
Locating your Spot ID App ID
Make sure you enter the correct credentials. Follow the instructions below to find your Spot ID and App ID:
From the Inventory window, select the app for which you want to locate the ID.
The Spot ID is located in brackets, next to the spot name. Click on it to save the ID to the clipboard.
To locate the App ID, click the three horizontal dots at the end of the row and then click Integration Options:
The Info window opens and your App ID and SDK information is displayed:
Step 3: Apple Requirements
There are some additional Apple Requirements.
Click here to review and add.
Step 4: Adding Delegates
Depending on your integration, you must add delegate information to your iOS integration at this point.
Depending on the module you are integrating, different delegates are required. Have a look below and select the necessary delegates.
Fyber Module | Delegate *Required |
---|---|
IASDKCore | Unit Delegate |
IASDKMRAID | HTML/MRAID Content Delegate |
IASDKVideo | Video Content Delegate |
IASDKNative |
Initializing the App
Initialization is an expensive operation. We recommend performing it at the initialization stage of the app.
The previous SDK had no requirement to explicitly initiate it (as opposed to the Android version SDK). It initialized itself dynamically (lazy loading) on the first code request to the SDK itself.
We defined the initialize process as mandatory because the Fyber SDK relies on the Revenue Console configuration. Without this configuration, no ad unit is shown and the SDK will not work.
The following takes place during the initialization phase:
- Initialization of all installed modules
- Local configuration load process (in case it is not a first runtime)
- Remote configuration fetching, parsing, loading and local configuration update.
Note
All Publisher (client side) Ad Requests are on hold until until the configuration is loaded to memory. The requests resume asynchronously once the config is ready. If a timeout occurs, the Publisher receives an ad failed
event.
Step 5: Adding User Consent
Note
Review the below GDPR related instructions (available starting iOS v7.0.8 SDK and legacy version v6.4.6)
GDPR
The General Data Protection Regulation of the European Union requires you to scope your user's consent. A user could be 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
We recommend you consult with a legal advisor to determine the best approach for your business. It is also highly recommended to collect user consent with a certified Consent Management Platform (CMP).
For a full list of CMPs, click here.
Once you have collected the user’s consent, you can pass it into the SDK using the following API of setGDPRConsent:
, e.g:
[IASDKCore.sharedInstance setGDPRConsent:YES]
GDPRConsent
is a boolean. It is true if you have the user’s consent. If you do not have the user's consent, it is false.
GDPRConsentString
is a string.
It is highly recommended to use the 2nd option of passing a consent string per the IAB's Transparent & Consent Framework by using a valid CMP (Consent Management Platform). This is the most common form of consent communication worldwide and is crucial in order to enjoy ad monetization in the EU. Using the boolean option is inferior and will eventually be deprecated during 2020.
We recommend that the first time you gather the user’s consent, you pass it onto the SDK before starting the SDK. The SDK then takes the user’s consent into consideration when initializing. In the following sessions, you need only call the API if the user updates their consent.
Setting Consent String
To set the GDPR Consent String, use the: setGDPRConsentString:
The consent string is passed as is.
Example
[IASDKCore.sharedInstance setGDPRConsentString:@""];
More information on GDPR can be found under the GDPR Resource Page and FAQs.
CCPA
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 Fyber and CCPA, refer to Fyber’s Resource Page.
For more information about CCPA, refer to the IAB CCPA Compliance Framework.
CCPA API
Once you have the CCPA string, you can pass it to the SDK using the following API:
API
`IASDKCore.sharedInstance.CCPAString = `
Example
IASDKCore.sharedInstance.CCPAString = @"1YNN";
To determine what value to use for the US Privacy String, refer to the IAB document here.
Example values:
- When CCPA does not apply (for example if the user is not a resident of California) you can either skip this API or use the following value 1---
- If the user choses NOT to opt out, and is ok with advertising as usual, you can use 1YNN
- If the user chooses to restrict advertising and opt out, you can use 1YYN
To clear the CCPA provided data, just pass a nil.
Clear Privacy Setting
IASDKCore.sharedInstance.CCPAString = nil;
Note
The Marketplace SDK does not validate the provided CCPA string and passes it, as is.
Next Steps
- Understanding Fyber Ads in the scope of SDK
- Integrate the Video
- Integrate the MRAID