ConsoliAds Standalone Integration

You are here:
Estimated reading time: 4 min

Integrate ConsoliAds

  1. Login to your ConsoliAds portal and download ConsoliAds SDK for Native iOS.
  2. Place all of the files in your project root (all files are mandatory)
  3. Add all files in project except “libConfigureServer.out”
  4. Requirements and settings to work with ConsoliAds SDK

   XCode version should be 8 or higher.

   Deployment Target should be equal to greater than 9.

   ConsoliAds SDK requires a device to run (would not build on simulator)

   Disable “Bitcode” option in build settings

   Add “–ObjC” flag in “Other linker flags” in build settings

Initialize ConsoliAds

  1. Import “ConsoliAds.h” and set up app’s name and bundle id as follows:
[ConsoliAds sharedInstance].productName=@" iOS SDK Sample";
[ConsoliAds sharedInstance].bundleIdentifier=@"com.onsonliAds.ios.sample";

2. Initialize ConsoliAds as follows:

[[ConsoliAds sharedInstance] initializeWithUserConsent:true viewController:self];

User Consent:

TRUE means user has provided the consent and will be shown personalized ads, whereas FALSE means is not willing to see personalized ads. It is developer’s responsibility to get user consent and pass it above initialization call.

ViewController:

The prevailing view controller upon initialization.

Interstitial Ads

•  Login to your ConsoliAds portal and go to Apps->Mediation-> (Your APP)->Placeholders & Ads
•  Add Interstitial and Video Ad slot as shown in the below figure:

Show ConsoliAds Interstitial Ad

Once initialized, ConsoliAds SDK is ready to show ads. Now show interstitial ad simply by the following code:

NOTE: Interstitial ads are not required to be requested.

[[ConsoliAds sharedInstance] showInterstitial:sceneIndex viewController:self];

This call requires the following mandatory parameters:

Scene Index:

Integer value for the index of the scene for which you want to show the Interstitial ad. As an example you should call above method with ‘0’ as scene index if you want to invoke the ad on your first scene regardless of its name.

ViewController
The prevailing ViewController showing the interstitial ad.

Rewarded Video Ads

•  Login to your ConsoliAds portal and go to Apps->Mediation-> (Your APP)->Placeholders & Ads
•  Add Rewarded Video Ad slot as shown in the below figure:

Load ConsoliAds Rewarded Video

Rewarded video ads in ConsoliAds are loaded and shown separately. Load rewarded video ad as follows:

[[ConsoliAds sharedInstance] loadRewarded:sceneIndex];

NOTE: It is highly recommended that you call LoadRewarded(sceneIndex) as early as possible to allow videos to be preloaded.

This call requires the following mandatory parameters:

Scene Index 
Integer value for the index of the scene for which you want to load the Rewarded video ad. As an example you should call above method with ‘0’ as scene index if you want to invoke the ad on your first scene regardless of its name.

Show Rewarded Video

Show Rewarded ad by simply the following code:

[[ConsoliAds sharedInstance] showRewardedVideo:sceneIndex viewController:self];

Scene Index 
Integer value for the index of the Scene for which you want to show the rewarded video ad. As an example you should call above method with ‘0’ as scene index if you want to invoke the ad on your first scene regardless of its name.

ViewController
The prevailing ViewController when showing the Rewarded Video ad.

Banner Ads

•  Login to your ConsoliAds portal and go to Apps->Mediation-> (Your APP)->Placeholders & Ads
•  Add Banner Ad slot as shown in the below figure:

Show Banner

Show banner ad by simply the following code:

[[ConsoliAds sharedInstance] showBanner:sceneIndex viewController:self];

This call requires the following mandatory parameters:

Scene Index 
Integer value for the index of the scene for which you want to show the banner ad. As an example you should call above method with ‘0’ as scene index if you want to invoke the ad on your first scene regardless of its name.

ViewController
The view controller at which you want to display banner .

NOTE: ConsoliAds SDK supports one banner per ViewController

Hide Banner

To hide banner ad simply call the following code:

[[ConsoliAds sharedInstance] hideBanner];

Native Ads

ConsoliAds provides the following approaches to show Native Ad:

   Single ConsoliAds’s Native Integration
Configure native ad for a single placeholder.

   Multiple ConsoliAds’s Native Integration 
Multiple native ad in a Table View.

•  Login to your ConsoliAds portal and go to Apps->Mediation-> (Your APP)->Placeholders & Ads
•  Add Native Ad slot as shown in the below figure:

 

Show Single ConsoliAds’s Native Ad

To configure ConsoliAds Native Ad, following are the required parameters:

SceneIndex: the index of the placeholder & scene for which you want to configure ConsoliAds Native Ad

View: Native Ad will be rendered on this view.

ViewController: this is the controller at which you want to display Native Ad

[[ConsoliAds sharedInstance] configureConsoliAdsNativeAd:sceneIndex nativeAdPlaceholder:nativeAdPlaceholder];

After calling the configure method you should call the following show method to ConsoliAds Native Ad:

[[ConsoliAds sharedInstance] showNativeAd:sceneIndex viewController:self];

Destroy Native Ad

To destroy Native ad simply call the the following code:

[[ConsoliAds sharedInstance] onDestroyForNativeAd:sceneIndex];

Callbacks for Native Ads

1.- (void)onNativeAdLoaded:(int)adNetworkName forIndex:(int)index;
2.- (void)onNativeAdFailedToLoad:(int)adNetworkName forIndex:(int)index;

Load Multiple Native Ads

Load native ads:

[[ConsoliAds sharedInstance] getNativeAd:sceneIndex];

Scene Index 
Integer value for the index of the scene for which you want to show the Native ad. As an example you should call above method with ‘0’ as scene index if you want to invoke the ad on your first scene regardless of its name.

Note: To load multiple native ads on the same scene, call the above method multiple times.

Icon Ads

   Icon ad comes in different sizes (Small, Medium, Large)

   Login to your ConsoliAds portal and go to Apps->Mediation->(Your APP)->Placeholders & Ads

   Add icon ad slot

Steps to show Icon Ad

Get icon ad:

IconAdBase *iconBase = (IconAdBase*)[[ConsoliAds sharedInstance] getIconAd:sceneIndex];

Show icon ad:

If( iconAdBase != nil ) {

IconAdView *view = [[IconAdView alloc]initWithAd:iconBase];

[self.iconView addSubview:view];
}

Configure Server

Steps to Configure Server:

   Find “libConfigureServer.out” in ConsoliAds SDK package and place it in the root directory of the project.

   Open terminal, change the directory path to the project root directory and run the following command:

./libConfigureServer.out userSignature packageName Apple

ConsoliAds GitHub Forum

If you are having any technical issues with ConsoliAds you can visit https://github.com/teamconsoliads/sampleapp-IOS to view known issues, share problems and suggestions.

Was this article helpful?
Dislike 1
Views: 124