Follow

AerServ iOS SDK Integration Version 3.1.2.1

iOS SDK

  Version #: 3.1.2.1 Updated: 06-19-18

Quick download:

   

 

Requirements

  • iOS Version 8.0+
  • Xcode 9

 

 

 

Step 1: Integrating the SDK


AerServ offers 3 options for integration:

1-1. CocoaPods

1-2. Static Integration

1-3. Swift Integration

 

Step 2: Initializing AerServSDK


You must initialize our SDK before loading any ads. Initializing AerServSDK will update server-side configurations and additionally initialize any mediated ad sources.

Within the AerServ dashboard, click on the inventory tab and edit the specific application that is being integrated. There will be an App ID associated to that application. Use that App ID to call AerServSDK's initializeWithAppID: in the early phases of the application. Suggested place to kick off the initialization process is in the application's AppDelegate inside the application:didFinishLaunchingWithOptions: method.

 

  • Objective-C
  • Swift
#import <AerServSDK/AerServSDK.h>
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
... // initialize AerServSDK with an App ID // replace 1000473 with your appliciation's App ID [AerServSDK initializeWithAppID:@"1000473"];
...
return YES;
}
import AerServSDK
...
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
...
// initialize AerServSDK with an App ID
AerServSDK.initialize(withAppID: "100473")
...
return true
}

 

To set or update the General Data Protection Regulation (GDPR) user consent flag, call AerServSDK’s +setGDPRWithUserConsent: method. Pass YES/true for user consent if GDPR user consent was granted and NO/false if user consent was denied or if unknown. To have the GDPR user consent flag to be set before an ad request, call +setGDPRWithUserConsent: before calling -loadAd. The values passed into +setGDPRWithUserConsent: will be stored in the NSUserDefaults, persisting the chosen consent. Thus, it is not necessary to reset the user consent value prior to each ad request; the value set is applicable for all subsequent requests until that value is reset.

 

An example would be:

 

  • Objective-C
  • Swift
// Replace YES with the actual consent value of user consent
[AerServSDK setGDPRWithUserConsent:YES];

BOOL userConsentFlag = [AerServSDK getGDPRConsentValue];
// Replace true with the actual consent value of user consent
AerServSDK.setGDPRWithUserConsent(true)

BOOL userConsentFlag = AerServSDK.getGDPRConsentValue()

 

 

 
Mediation Disclaimer:
Please be advised that although we are GDPR compliant, we currently have no way to send GDPR compliance as well as user consent to our mediated SDK partners. Compliance responsibility and request handling will solely depend on the SDK mediated partner. Please contact your mediated partners to avoid any issues and/or complications.

 

 

Step 3: Display Banner Ads


Create an ASAdView object by passing in a placement setup on the AerServ dashboard as well as the banner's size. Refer to ASAdView.h for AerServSDK's predefined sizes.

 

  • Objective-C
  • Swift
#import <AerServSDK/AerServSDK.h>
...
ASAdView *asAdView = [ASAdView viewWithPlacementID:@"1024876" andAdSize:ASBannerSize];
import AerServSDK
...
var asAdView = ASAdView(placementID: “1024876”, andAdSize: ASBannerSize)

 

Add the ASAdView object to your application's view.

 

  • Objective-C
  • Swift
[self.view addSubview:asAdView];
view.addSubview(asAdView!)

 

In the view controller that the ASAdView object is added to, make sure that the view controller adheres to the ASAdViewDelegate protocol. Additionally, add the callback viewControllerForPresentingModalView that will return itself.

 

  • Objective-C
  • Swift
@interface ViewController() <ASAdViewDelegate>
...
- (UIViewController*)viewControllerForPresentingModalView {
    return self;
}

class ViewController: UIViewController, ASAdViewDelegate {
...
func viewControllerForPresentingModalView() -> UIViewController! {
return self
}
}

 

Lastly, kick off the ad request by loading the ad.

 

  • Objective-C
  • Swift
[asAdView loadAd];
asAdView?.loadAd()

 

Additional Banner Callbacks

Please refer to ASAdView.h for all available callbacks and descriptions of each. Settings for supplying ad targeting key words, specifying the banner refresh time interval, preloading, and more can be found in the ASAdView header as well.

 

Step 4: Displaying Interstitial Ads


Create an ASInterstitialViewController object with a placement setup on the AerServ dashboard and a delegate that conforms to ASInterstitialViewControllerDelegate.

 

  • Objective-C
  • Swift
#import <AerServSDK/AerServSDK.h>
...
@interface ViewController() <ASInterstitialViewControllerDelegate>

@property (nonatomic, strong) ASInterstitialViewController *asInterstitialVC;
...
self.asInterstitialVC = [ASInterstitialViewController viewControllerForPlacementID:@"1000741" withDelegate:self];

import AerServSDK

class ViewController: UIViewController, ASInterstitialViewControllerDelegate {

var asInterstitialVC: ASInterstitialViewController?
...
asInterstitialVC = ASInterstitialViewController(forPlacementID: “1000741”, with:self)
}

 

Start the ad request by loading an ad with your specified settings.

 

  • Objective-C
  • Swift
[self.asInterstitialVC loadAd];
asInterstitialVC?.loadAd()

 

When the ad is ready, a callback event will be triggered. From the callback, the interstitial ad can be shown from a parent view controller.

 

  • Objective-C
  • Swift
- (void)interstitialViewControllerAdLoadedSuccessfully:(ASInterstitialViewController *)viewController {
[viewController showFromViewController:aViewController];
}
func interstitialViewControllerAdLoadedSuccessfully(_ viewController: ASInterstitialViewController!) {
asInterstitialVC?.show(from: self)
}

  

Optional Interstitial Steps

Preloading Interstitial Ads 

Additional Interstitial Callbacks 

Please refer to ASInterstitialViewController.h for all available callbacks and descriptions for each. Settings for supplying ad targeting key words, video player controls, and more can be found in the ASInterstitialViewController header as well.

 

Additional Settings


Header Bidding Requests

Pausing & Resuming Video Ads

Virtual Currency

Ad Transaction Information

Adding Keyword Tagging

Adding Publisher Keys

Enabling Geolocation Targeting

Disabling App Transport Security for iOS 9+

Muting Interstitial Ads

Disabling Interstitial Animation

 

Version History


View iOS Version History

 

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments