FeedAd iOS SDK
This guide explains how to integrate the FeedAd SDK into an iOS app. The SDK can be used within both Objective-C and Swift apps. This guide walks you through all steps necessary to get started with the integration of the specific ad types.
Requirements
- A FeedAd SDK
client tokento be found in the admin panel - iOS SDK 15.0+
Installation via Swift Package Manager
The FeedAd SDK is available as a xcframework that can be installed via Swift Package Manager.
Either add it to your Package.swift as a dependency:
dependencies: [ .package(url: "https://bitbucket.org/feedad/feedad-ios-spm.git", .upToNextMajor(from: "1.6.0")) ]
Or manually add it as a package dependency in your Xcode project by following these steps:
- Open your project in Xcode
- Goto File > Add Package Dependencies ...
- In the search field, enter the repository URL: https://bitbucket.org/feedad/feedad-ios-spm.git
- Choose the dependency rule and what projects to add the package to
- Click Add Package
Initialization
The SDK needs to be initialized with your client token as soon as your app starts. Add the following initialization code to your app delegate:
Using Objective-C:
#import <FeedAd/FeedAd.h> @implementation FAAppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // ... // Setup config with client token FAConfig *config = [FAConfig new]; config.clientToken = @"your-client-token"; // Set to YES, if you are using a TCF 2.0 CMP and // want FeedAd to wait for user consent config.waitForConsent = NO; // Configure FAManager [[FAManager sharedManager] configure:config]; // ... } @end
Using Swift:
Import the FeedAd framework into your bridging header:
#import <FeedAd/FeedAd.h>
Update your app delegate:
class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // ... // Setup config with client token let config = FAConfig() config.clientToken = "your-client-token" // Set to true, if you are using a TCF 2.0 CMP and // want FeedAd to wait for user consent config.waitForConsent = false // Configure FAManager FAManager.shared().configure(config) // ... }
Integration Guides
Now that the SDK has been initialized, please continue with the specific integration guides for the ad types you would like to integrate into your app: