Latest 2.3.0
Homepage https://github.com/buzzvil/baro-ios-sdk
License MIT
Platforms ios 8.0, requires ARC
Dependencies AFNetworking, SDWebImage

BARO-iOS-SDK Integration Guide

  1. Requirements
  2. Integration
  3. Usage
    1. Swift
    2. Objective-C
  4. Mediation

Requirements

  • iOS 8 or higher
  • Both Swift and Objective-C are supported

Integration

  1. Add this line to your Podfile.

    pod 'BARO', '~> 2.2.0'
  2. Add following properties to your info.plist to allow ads to be served via HTTP on iOS 9 or higher.
    <key>NSAppTransportSecurity</key>
    <dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    </dict>

Usage

Swift

Step 1: Initialize BARO

In AppDelegate’s application:didFinishLaunchingWithOptions

import BARO

BARO.configure(BAROEnvProduction, mediationAdapterClasses: [], logging: true)

Step 2: Prepare BAROAdView

  1. Add a BAROAdView to your view.
  2. Design your BAROAdView in your Storyboard or Interface Builder. Or by code.

Step 3: Fetch and Render Ad

let adLoader = BAROAdLoader(unitId: "your_unit_id", preloadEnabled: false)
adLoader.loadAd(
  with: BAROUserProfile(birthday: birthday, gender: BAROUserGenderMale), // optional 
  location: BAROLocation(latitude: 37.53457, longitude: 128.23423) // optional
  ) { [weak self] (ad, error) in
    if let ad = ad {
      self?.adView.delegate = self // optional
      self?.adView.renderAd(ad)
    } else {
      // Handle error
    }
}

Note: Use adView.isPresentingAd() to check BAROAdView is currently presenting an ad or not

Step 4: Handle ad events (optional)

// BAROAdViewDelegate
func adViewDidImpressed(adView: BAROAdView) {
  // Impressed!
}

func adViewDidClicked(adView: BAROAdView) {
  // Clicked!
}

 

Objective-C

Step 1: Initialize BARO

In AppDelegate’s application:didFinishLaunchingWithOptions

#import <BARO/BARO.h>

[BARO configure:BAROEnvProduction mediationAdapterClasses:@[] logging:YES];

Step 2: Prepare BAROAdView

  1. Add a BAROAdView to your view.
  2. Design your BAROAdView in your Storyboard or Interface Builder. Or by code.

Step 3: Fetch and Render Ad

BAROAdLoader *adLoader = [[BAROAdLoader alloc] initWithUnitId:@"your_unit_id" preloadEnabled: NO];
BAROUserProfile *userProfile = [[BAROUserProfile alloc] initWithBirthday:birthday gender:BAROUserGenderMale];
BAROLocation *location = [[BAROLocation alloc] initWithLatitude: 37.53457 longitude: 128.23423];

__weak YourClass *weakSelf = self;
[adLoader 
  loadAdWithUserProfile:userProfile // or nil
  location:location // or nil
  completion:^(BAROAd * _Nullable ad, NSError * _Nullable error) {
    if (ad) {
        [weakSelf.adView renderAd:ad];
    } else {
      // Handle error
    }
}];

Note: Use [adView isPresentingAd] to check BAROAdView is currently presenting an ad or not

Step 4: Handle ad events (optional)

// BAROAdViewDelegate
- (void)adViewDidImpressed:(BAROAdView *)adView {
  // Impressed!
}

- (void)adViewDidClicked:(BAROAdView *)adView {
  // Clicked
}

Mediation

  1. Add the following lines to your Podfile to enable mediation.

    • AdMob: pod 'BARO/AdmobMediation'
    • MoPub: pod 'BARO/MopubMediation'
    • Baidu: pod 'BARO/BaiduMediation'
  2. In your AppDelegate, pass desired mediation adapters when initializing BARO.

Swift

import BAROAdmobMediation
import BAROBaiduMediation
import BAROMopubMediation

BARO.configure(BAROEnvProduction, mediationAdapterClasses: [BAROAdmobMediationAdapter.self, BAROMopubMediationAdapter.self, BAROBaiduMediationAdapter.self], logging: true)

Objective-C

#import <BAROAdmobMediation/BAROAdmobMediation.h>
#import <BAROBaiduMediation/BAROBaiduMediation.h>
#import <BAROMopubMediation/BAROMopubMediation.h>

[BARO configure:BAROEnvProduction mediationAdapterClasses:@[BAROAdmobMediationAdapter.class, BAROBaiduMediationAdapter.class, BAROMopubMediationAdapter.class] logging:YES];

Latest podspec

{
    "name": "BARO",
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "summary": "Boost your ad revenue with BuzzAd Revenue Optimizer!",
    "version": "2.3.0",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": "Buzzvil",
    "homepage": "https://github.com/buzzvil/baro-ios-sdk",
    "source": {
        "http": "https://github.com/Buzzvil/baro-ios-sdk/releases/download/v2.3.0/BARO.zip"
    },
    "static_framework": true,
    "dependencies": {
        "AFNetworking": [
            "~> 3.0"
        ],
        "SDWebImage": [
            "~> 4.0"
        ]
    },
    "vendored_frameworks": "BARO.framework",
    "default_subspecs": "Core",
    "subspecs": [
        {
            "name": "Core"
        },
        {
            "name": "AdmobMediation",
            "dependencies": {
                "Google-Mobile-Ads-SDK": []
            },
            "vendored_frameworks": [
                "BARO.framework",
                "BAROAdmobMediation.framework"
            ]
        },
        {
            "name": "MopubMediation",
            "dependencies": {
                "mopub-ios-sdk": [
                    "~> 5.0"
                ]
            },
            "vendored_frameworks": [
                "BARO.framework",
                "BAROMopubMediation.framework"
            ]
        },
        {
            "name": "BaiduMediation",
            "vendored_frameworks": [
                "BARO.framework",
                "DUModuleSDK.framework",
                "BAROBaiduMediation.framework"
            ]
        }
    ]
}

Pin It on Pinterest

Share This