Get Started with Glispa Connect

Overview

Examples

Android

Overview

- Native Ads

List/Feed

Custom

- Standard IAB Formats

Banner

Interstitial

Video

- Others

GDPR

Troubleshooting

Admob Android Adapter

Mopub Android Adapter

DFP Android Adapter

iOS

Overview

- Native Ads

List/Feed

Custom

- Standard IAB Formats

Banner

Interstitial

Video

- Others

GDPR

Troubleshooting

- Adapters

Admob iOS Adapter

Mopub iOS Adapter

DFP iOS Adapter

API Documentation

Reporting API

Help

GDPR FAQ

General

Earnings

Payments and Accounting

Integration

Reporting

Legal and Privacy

Updates

SDK Deprecation Schedule

SDK Change Log

Android Change Log

iOS Change Log

Interstitial

Updated 3 months ago by Derek Lim

Overview

This tutorial helps you setup interstitial ads in your iOS app and receive your first ad from the Glispa Connect (formerly Avocarrot) Exchange.

Prerequisites

Create an Interstitial ad unit from your app on Glispa Connect Dashboard 

Requirements & Dependencies

  • Target iOS 8.0 or higher

Setup SDK

Glispa Connect iOS SDK supports iOS 8.0 or higher.

You can add Glispa Connect SDK to your project using Cocoapods  (recommended) or manually

Note: If you don’t have pods in your project, set them up using the Getting Started guide
  1. Add pod ‘avocarrot-ios-sdk/Core’ to your Podfile to integrate it to your project
  2. Add the ad types you require to your Podfile:
    pod 'avocarrot-ios-sdk/Interstitial'

We also have sample code available at our GitHub repository.

Manual Glispa Connect SDK integration guide

  1. Add the following SDK files to your project (required)
    Ad type Frameworks
    Interstitial AvocarrotCore.framework, AvocarrotInterstitial.framework, Mraid.framework
  2. Add -ObjC flag to project settings (Other Linker Flags property)  

    Note: If your app can’t use -ObjC flag just add -force_load $(PROJECT_DIR)/Pods/avocarrot-ios-sdk/AvocarrotSDK.framework/Versions/Current/AvocarrotSDK flag to Other Linker Flags

  3. Required system libraries for all libs

    The SDK with adapters uses the following system frameworks and libraries. You can set flag “Link Frameworks automatically” to YES otherwise you should add following system frameworks and libraries to your project manually:

    WebKit

    Security

    QuickLook

    MobileCoreServices

    CoreText

    AssetsLibrary

    Foundation

    CoreData

    Social

    MessageUI

    MediaPlayer

    EventKit

    EventKitUI

    QuartzCore

    CoreMedia

    CFNetwork

    SystemConfiguration

    CoreGraphics

    StoreKit

    CoreTelephony

    AVFoundation

    AdSupport

    AudioToolbox

    UIKit

    libxml2

    libsqlite3

    libz

Warning: Some Xcode versions support new settings only after the Xcode reboot. This also cleans the Xcode cache and remedies other problems.

TO DO list if you have a linking problem:

  • Clean Build
  • Restart Xcode
  • Delete your DerivedData folder in ~/Library/Developer/Xcode/DerivedData
  • Restart the computer

ATS settings in iOS 9.0 and greater

Since the Glispa Connect SDK uses 3rd party networks to load ads and we have no control over these networks loading their content via https, you should disable ATS for your application to ensure the SDK behaves as intended. To disable ATS add the following settings to your application Info.plist file:

<key>NSAppTransportSecurity</key>
          <dict>
              <key>NSAllowsArbitraryLoads</key><true/>
              <key>NSAllowsArbitraryLoadsForMedia</key><true/>
              <key>NSAllowsArbitraryLoadsInWebContent</key><true/>
          </dict>
As the General Data Protection Regulation (GDPR) takes effect on May 25th, 2018 it is required to use the latest GDPR ready SDK and pass your users’ consent as seen here, in order to be up-to-date and compliant.

Set up Interstitial Ads

Interstitial size is defined automatically, depending on the screen size.

Use the following methods in your UIViewController subclass:

- (void)loadInterstitialWithAdUnitId:(NSString *_Nonnull)adUnitId
                  success:(void (^ _Nullable)(AVOInterstitial *_Nonnull interstitial))success
                  failure:(void (^ _Nullable)(AVOError *_Nonnull error))failure;
          - (void)loadInterstitialAndShowWithDelayWithAdUnitId:(NSString *_Nonnull)adUnitId
                  forViewController:(UIViewController *_Nonnull)viewController
                  success:(void (^ _Nullable)(AVOInterstitial *_Nonnull interstitial))success
                  failure:(void (^ _Nullable)(AVOError *_Nonnull error))failure;               
          

Two different presentation methods are available for interstitials. These are as follows:

  • loadInterstitialWithAdUnitId
  • loadInterstitialAndShowWithDelayWithAdUnitId

The loadInterstitialWithAdUnitId method is to load the interstitial and call the success block if the interstitial loaded. You can show the interstitial from this block immediately. The loadInterstitialAndShowWithDelayWithAdUnitId method loads the interstitial, calls the success block and shows it after a delay, which returns from the server. From the success block you can save it to your UIViewController subclass property, show it immediately or do nothing.

Note: If delay is not specified, the interstitial will be shown immediately after the load is finished.

For example:

#import <AvocarrotInterstitial/AvocarrotSDK+AVOInterstitial.h>
          ...
          __weak typeof(self) weakSelf = self;
          [AvocarrotSDK.sharedSDK loadInterstitialWithAdUnitId:@"YOUR_INTERSTITIAL_AD_UNIT_ID"
                               success:^(AVOInterstitial * _Nonnull interstitial) {
                                  weakSelf.intestitial = interstitial;
                                  [interstitial showFromViewController:weakSelf];
                              } failure:nil];
          [AvocarrotSDK.sharedSDK loadInterstitialAndShowWithDelayWithAdUnitId:@"YOUR_INTERSTITIAL_AD_UNIT_ID"
                               forViewController:self
                               success:^(AVOInterstitial * _Nonnull interstitial) {
                                 weakSelf.intestitial = interstitial;
                               } failure:nil];
          
import AvocarrotInterstitial
          ...
          AvocarrotSDK.shared.loadInterstitial(withAdUnitId: "YOUR_INTERSTITIAL_AD_UNIT_ID",
                                            success: { [unowned self] (interstitial) in
                                                self.interstitial = interstitial
                                                interstitial.show(from: self)
                                         }, failure: nil)
          AvocarrotSDK.shared.loadInterstitialAndShowWithDelay(withAdUnitId: "YOUR_INTERSTITIAL_AD_UNIT_ID",
                                                            for: self,
                                                            success: { [unowned self] (interstitial) in
                                                                self.interstitial = interstitial
                                                         }, failure: nil)

Interstitial events handling

To process interstitial events, you should implement blocks or subscribe to notifications. The following is available:

MethodDescriptionNSNotificationCenter key
(void (^ _Nullable)(AVOInterstitial*_Nonnull interstitial))successCalled after the interstitial is served. After this method is called, the interstitial is ready to be displayed.
(void (^ _Nullable)(AVOError *_Nonnull error))failureCalled if the interstitial was not downloaded.
- (instancetype _Nonnull)onClick:(nullable void (^)(void))blockCalled after a click on the interstitial. After this event an external browser or a SKStoreProductViewController will be opened.kAVONotification_InterstitialClicked
- (instancetype _Nonnull)onDidHide:(nullable void (^)(void))blockCalled after the interstitial disappears from the screen.kAVONotification_InterstitialDidHide
- (instancetype _Nonnull)onDidShow:(nullable void (^)(void))blockCalled after the interstitial is displayed.kAVONotification_InterstitialDidShow
- (instancetype _Nonnull)onWillHide:(nullable void (^)(void))blockCalled after the tap on the “close” button, directly before the interstitial disappears.kAVONotification_InterstitialWillHide
- (instancetype _Nonnull)onWillLoad:(nullable void (^)(void))blockCalled before sending interstitial request to server.kAVONotification_InterstitialWillLoad
- (instancetype _Nonnull)onWillShow:(nullable void (^)(void))blockCalled before displaying the interstitial.kAVONotification_InterstitialWillShow

Advanced Customization

Go Live!

  1. Remove sandbox. If you have received a sample ad then simply disable the Sandbox mode by including the following instruction in your code:
    AvocarrotSDK.testMode = NO
    You should disable Sandbox mode ONLY when you are done with the integration and you are ready to publish your app. It is against Glispa Connect's policies to use live ads during development, and doing so could get your Glispa Connect account banned.
  2. Publish your app. You are now ready to upload your app and start making money! If you have submitted your app in the Google Play/ Apple Store and you can see live ads, then you have nothing to worry about. Just wait until the impressions threshold has been reached and the app will be shown as live in your dashboard as well.
  3. Update payment details. Login to your account and update your payment settings.

Was this article useful?