-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
This document details the process of integrating the Yieldmo SDK with your mobile application.
The Yieldmo SDK only works with iOS 8.0 and above.
The recommended way of installing the Yieldmo SDK is via Cocoapods.
-
Add
YieldmoSDKto your Podfile in your project directory. Example:source 'https://github.com/CocoaPods/Specs.git' target 'YourAppName' do pod 'YieldmoSDK', '~> 4.0.0' end -
In the same directory as your Podfile run the command
pod install. -
Follow our Integration Guide to render Yieldmo ads in your app.
If you prefer not to use Cocoapods, our SDK is also distributed as a framework that you can include into your application manually.
- Download the Yieldmo SDK here.
- Unzip the Yieldmo SDK.
- Drag
Yieldmo.frameworkinto your Xcode application group (be sure to check the "Copy items into destination group's folder" option). - Follow our Integration Guide to render Yieldmo ads in your app.
Yieldmo ads usually appear within scrollable content. Adding one to your app takes just a few lines of code.
Steps to integrate an Ad for a placement:
- Initialize Yieldmo in your AppDelegate:
/* Objective-C */
@import Yieldmo;
...
// Initialize SDK
[Yieldmo startWithAppID: kDemoAppID];/* Swift */
import Yieldmo
...
// Initialize SDK
Yieldmo.startWithAppID(kDemoAppID)Note: The sample code above uses a demo app ID. Please contact your Yieldmo representative to obtain your own unique app ID. Learn more about app ID's in Before You Launch.
- In your custom ViewController, add a strong reference to a YMPlacementView, initialize it, and add it as a subview where appropriate:
/* Objective-C */
// Declare a strong property to hold the ad view
@property (nonatomic, strong) YMPlacementView * adView;
...
// Initialize the view
self.adView = [Yieldmo placementWithFrame: CGRectMake(0, 0, 320, 200)
WithID: kDemoPlacement_Postcard];
...
// Add it as a subview where you want it displayed
[self.view addSubview:self.adView];/* Swift */
// Declare a property to hold the ad view
var adView: YMPlacementView?
...
// Initialize the view
adView = Yieldmo.placementWithFrame(CGRectMake(0, 0, 320, 200), withID: kDemoPlacement_Postcard)
...
// Add it as a subview where you want it displayed
view.addSubview(adView!)Note: The sample code above uses a demo placement ID. Please contact your Yieldmo representative to obtain your own unique placement IDs. Learn more about placement ID's in Before You Launch.
- Make your custom ViewController conform to the
YMPlacementViewDelegateprotocol and implement the following required method:
/* Objective-C */
// Conform to YMPlacementViewDelegate
@interface ViewController : UIViewController <YMPlacementViewDelegate>
// Assign the placement view's delegate
self.adView.delegate = self;
// Implement required delegate method to give permission for ad resizing:
#pragma mark - YMPlacementViewDelegate methods
- (BOOL) adViewShouldResize: (YMPlacementView *) placementView toPosition: (CGRect) position {
return YES;
}/* Swift */
// Conform to YMPlacementViewDelegate
class ViewController: UIViewController, YMPlacementViewDelegate {
// Assign the placement view's delegate
adView!.delegate = self
// Implement required delegate method to give permission for ad resizing:
// MARK: - YMPlacementViewDelegate methods
func adViewShouldResize(placementView: YMPlacementView, toPosition position: CGRect) -> Bool {
return true
}Note: To find out more about all the available YMPlacementViewDelegate methods, see our YMPlacementViewDelegate page.
Start Here
iOS Version Support
Troubleshooting & Logging
Have a previous SDK?