Integrating the iOS SDK

Integrating with Cocoapods

Follow these steps to integrate via Cocoapods:

  1. Open a terminal.
  2. Navigate to your project folder.
  3. Create an empty pod file:

Ruby

touch 'Podfile'
  1. Edit the pod file:

Ruby

nano Podfile
  1. Add the following lines and substitute the <YOUR TARGET> with the real one:

Ruby

target '' do
  pod 'Fyber_Marketplace_SDK'
end
  1. Save and exit using Ctrl+O -> Enter -> Ctrl+X
  2. Run install:

Ruby

pod install
  1. After the pods have been installed, the ongoing work with Xcode should happen via its workspace file and not project file.

  2. Import the IASDKCore into the AppDelegate class:

Objective-C

#import <IASDKCore/IASDKCore.h>

Troubleshooting

If you get the response The target ... overrides the OTHER_LDFLAGS build setting defined in ...
  • Add the $(inherited) flag to the Other Linker Flags .
 
In case of Unable to find a specification for...
  • 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:
  1. Go to Revenue Desk and sign-in
  2. On the left menu bar select SDKs

7167c64-Screen_Shot_2020-08-05_at_13.06.07.png

  1. 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. 

Step 1: Integrating the Modules

  1. Drag the desired modules to your project.
d65434a-modulesDrag.jpg
  1. 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.

5b8dc3a-copyIfNeeded.jpg
  1. Link the app target with the IASDKCore Module by clicking your application target -> Build Phases -> Link Binary With Libraries.

Expand this window.

2523e03-build_phases.png
  1. 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.

9708589-buildPhasesDrag.jpg
  1. Once this is completed, repeat the process for any other added IASDK Module (Video, MRAID, Native).
  2. 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.
38a269b-copyBundle.jpg
  1. 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.

  1. 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.

  1. 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.

  1. 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];

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

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request