This guide helps you setup Banner ads in your iOS app and receive your first ad from the Glispa Connect (formerly Avocarrot) Exchange.
Requirements & Dependencies
- Target iOS 8.0 or higher
Glispa Connect iOS SDK supports iOS 8.0 or higher.
You can add Glispa Connect SDK to your project using Cocoapods (recommended) or manually
pod ‘avocarrot-ios-sdk/Core’to your Podfile to integrate it to your project
- Add the ad types you require to your Podfile:
We also have sample code available at our GitHub repository.
Manual Glispa Connect SDK integration guide
- Add the following SDK files to your project (required)
Ad type Frameworks Banner
-ObjCflag to project settings (Other Linker Flags property)
Note: If your app can’t use
-ObjCflag just add
-force_load $(PROJECT_DIR)/Pods/avocarrot-ios-sdk/AvocarrotSDK.framework/Versions/Current/AvocarrotSDKflag to Other Linker Flags
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
YESotherwise you should add following system frameworks and libraries to your project manually:
TO DO list if you have a linking problem:
- Clean Build
- Restart Xcode
- Delete your DerivedData folder in
- 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 Glispa Connect 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>
Setup Banner Ads
Available banner sizes:
- AVOBannerViewSizeSmall (320x50) (recommended)
- AVOBannerViewSizeMREC (300x250)
- AVOBannerViewSizeLarge (728x90)
- Use the following methods in your UIViewController subclass:
- (void)loadBannerWithSize:(AVOBannerViewSize)size adUnitId:(NSString *_Nonnull)adUnitId success:(void (^ _Nullable)(AVOBannerView *_Nonnull bannerAd))success failure:(void (^ _Nullable)(AVOError *_Nonnull error))failure;
- Add the following code to
- If you want to switch banner auto-update off:
self.bannerView.autoUpdate = NO;
- If you want to stop and remove banner from screen:
Standard banner events handling
To process banner events, you should implement blocks or subscribe to notifications:
|Called after the banner is served successfully.|
|Called if the banner was not downloaded.|
|Called after a click on a banner. After this event app will be minimized and an external browser will be opened.|
To include user data in the SDK, please set up the following properties:
#import <AvocarrotCore/Avocarrot.h> ... + (void)setBirthday:(NSDate *_Nonnull)birthday; + (void)setGender:(AVOUserGender)userGender; + (void)setInterests:(NSArray<NSString *> *_Nonnull)interests;
#import <AvocarrotCore/Avocarrot.h> ... [AvocarrotSDK setGender:AVOUserGenderMale]; [AvocarrotSDK setBirthday:[NSDate date]]; [AvocarrotSDK setInterests:@[@"running", @"shopping", @"fitness", @"sport"]];
- 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 = NOYou 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.
- 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.
- Update payment details. Log in to your account and update your payment settings.