Getting started with Fyber SDK
Before You Add the SDK to Your Project
The latest Fyber iOS SDK supports iOS 6 and newer as minimum deployment targets and requires iOS 7 SDK or newer as a minimum base SDK version.
Update your Apple Advertising Identifier settings
The Fyber SDK accesses the Apple Advertising Identifier (IDFA), therefore you have to make sure to update the corresponding section in iTunes Connect with information about how the identifier is used in your application.
If you use the Fyber SDK…
- …to show ads through one of our ad formats, please, check the “Serve advertisements within the app” option
- …for install attribution, please, check the “Attribute this app installation to a previously served advertisement” option
- …for attribution of rewarded actions, please, check the “Attribute an action taken within this app to a previously served advertisement” option
Please note that Fyber uses the Advertising Identifier in compliance with the Apple guidelines for usage of the Advertising Identifier, including the “Limited Advertising Purposes” clause, hence honoring user’s “Limit Ad Tracking” setting.
How to add the SDK to your project
Installation with CocoaPods
CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like FyberSDK in your projects. See the CocoaPods Getting Started and Using CocoaPods for more information.
pod 'FyberSDK', '~> 8.0'
Manual Installation of the SDK
Download the latest version of the Fyber SDK from the Downloads page.
fyber-sdk-libfolder from a Finder window to your project’s Xcode window. You can find this folder in the zip that downloaded previously.
Xcode will show a sheet prompting for more details about what to do with the dropped folder. Make sure that “Create groups for any added folders” is checked.
Check your application’s target in the “Add to targets” section.
Note: Ensure the contents of the
fyber-sdk-libfolder are added to your target’s compile sources. You can check for this by clicking on your project in Xcode’s Project Navigator, then clicking on your target, and selecting the “Build Phases” tab. The static library file contained in the
fyber-sdk-libshould be included in the list of files shown on the “Link Binary With Libraries” phase. If Xcode hasn’t done this automatically, please add them manually.
- If your project has modules enabled you can skip this step. Modules have been enabled by default since Xcode 5.
To enable modules set Enable Modules (C and Objective-C) and Link Frameworks Automatically to YES.
In case modules cannot be enabled, you need to link the following frameworks to your project:
- AdSupport framework, used to fetch Apple’s Advertising Identifier and Advertising Tracking Enabled status from the user’s device.
- CoreGraphics, used by the iToast library included with the SDK. The SDK relies on this library to show reward notifications to your users;
- CoreLocation framework;
- CoreTelephony framework, which is used to detect the carrier name and country of the device in which the SDK is running;
- MediaPlayer framework, used by our video player;
- QuartzCore framework, used for drawing;
- StoreKit framework, used to provide in-app stores;
- SystemConfiguration framework, which is used to detect the way your users are connected to the Internet and react to network connection losses with the appropriate error message
Important: StoreKit and AdSupport frameworks are only available from iOS 6 on. If you plan to make your application compatible with devices running earlier versions of iOS, mark this link as optional.
-ObjClinker flag to your project. This can be done in the Build Settings, in the Other Linker Flags row
- Disable App Transport Security (ATS) by adjusting your app’s
.plistconfiguration file with the following:
<key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict>
Installing the SDK’s API documentation in Xcode
The SDK’s API docset is available at the following URL:
As of Xcode 5, third party docsets are not supported natively anymore. If you want to access Fyber documentation from Xcode, we recommend the use of Docs for Xcode.
Initializing the Fyber SDK
Find your App ID and Client security token in the Fyber dashboard in your app’s settings tab under SDK Configuration
Find a point in your application’s code that is run once when it starts or resumes. For example, the
application:didFinishLaunchingWithOptions:method in your application delegate.
Make sure the
FyberSDK.hfile is included, for example by including the following statement at the beginning of the file you’re working with:
Add this snippet to the section of your code that will be run when your app starts or resumes, making sure to substitute the placeholders with your values for App ID, User ID and Security Token:
FYBSDKOptions *options = [FYBSDKOptions optionsWithAppId:@"00000" userId:@"userId" securityToken:@"000000000000000000000000"]; [FyberSDK startWithOptions:options];
Note: Please make sure to use a
userIdthat is unique within your system and clearly identifies a particular user.
If you do not want to set a
userIdyourself and prefer that the Fyber SDK would create it for you, the Fyber SDK can create it for you:
FYBSDKOptions *options = [FYBSDKOptions optionsWithAppId:@"00000" securityToken:@"000000000000000000000000"]; [FyberSDK startWithOptions:options];
This method will generate a unique
userId on the first launch of the application and then store it for subsequent launches. In case the user re-installs the app a new
userId would be generated.
Subsequent usages of the Fyber SDK during your application’s lifecycle will reuse the parameters passed to this call. The
userId are only needed if you want to use Fyber’s ad monetization products such as the Offer Wall.
Configuring SDK permissions to access device identifiers
On every request to the Fyber servers, the SDK will retrieve (or calculate) and send the following device identifiers:
- Apple’s advertising identifier (IDFA), if allowed by the user
- WiFi adapter’s MAC address (iOS 6 only)
- SHA1 and MD5 hashes of the retrieved MAC address (iOS 6 only)
Fyber SDK and Cookie Accept Policy
To be able to use all the features that the Fyber Ad Monetization Platform provides, your application must accept cookies coming from our platform. By default, this setup is done before starting the Fyber SDK:
[NSHTTPCookieStorage sharedHTTPCookieStorage].cookieAcceptPolicy = NSHTTPCookieAcceptPolicyAlways;
In addition, you can adjust this configuration by changing the value:
Using the Fyber SDK for Advertising
At this point you have completed the steps necessary to integrate the Fyber sdk. You can now proceed to the documentation related to the ad format(s) you wish to use as a publisher. If you plan to use the Fyber sdk for advertising you can proceed to the section on advertising.