Beachfront.io is the easist way monetize your app using Interstitial and Preroll Video Ads. This document shows you how to integrate Beachfront.io into your iOS app.
What You'll Need
- Xcode version 4.5 or higher
- An iOS app targeting at least iOS version 5.1
Installing the SDK
- Get a Beachfront.io account if you don't already have one.
- Login to the dashboard and create a new app.
- Click 'Edit App' and you will see your App ID & Ad Unit Id (copy for later).
- Download the SDK and drag-drop the BFIOSDK.embeddedframework into your Xcode project folder.
- In the "Build Phases" section of your project target, navigate to "Copy Bundle Resources" and make sure 'BFIOSDK.bundle' is listed. If not, find it under the Resources folder in BFIOSDK.embeddedframework and drag it in.
- In the "Build Phases" section of your project target, navigate to "Link Binary with Libraries" and add the BFIOSDK.framework to the list (if not already there).
- While you're still in "Link Binary with Libraries" add the frameworks:
IMPORTANT: In the "Build Settings" section of your project target, navigate to "Other Linker Flags" and add '-ObjC' if not already present.
Import the framework header wherever you want to show an Ad.
Showing Interstitial Ads
Whenever you want to show an Interstitial Video Ad use the following method call:
[BFIOSDK showAdWithAppID:@"yourAppID" adUnitID:@"yourAdUnitID"];
Showing Preroll Ads
Whenever you want to show a Preroll Video Ad use the following method call:
[BFIOSDK showPrerollAdInView:self.view inRect:_yourPlayer.view.frame AppID:@"yourAppID" adUnitID:@"yourAdUnitID"];
Listening for Events
Optionally register for BFIO Ad events by adding your controller as an observer to the following SDK notifications:
Fires after interstitial view opens
Fired after interstitial ad video starts playing
Fired when an ad video is completed
Fired when an ad interstitial view is closed
Fired when a preroll ad has started
Fired when a preroll ad has completed
Check out the Examples
Also see the sample app 'BFIOSDKExample' included in the SDK download bundle. It contains clear examples on how to show an interstitial ad and register for events.