iOS SDK Guide

13 minute read

Minah Kim

The current version is 105.

Sample Project

Bitbucket
git clone https://mezzomedia_adtech@bitbucket.org/mezzomediaadtech/ios.git

Ad type

Type Sample Description
standard banner typical bar banner
It is located mostly at the bottom, but can also be published at the top or in the middle, depending on the adjustments made by the publisher.
interstitial When an app is running, ads are posted on the front page, and publishers can adjust the exposure area.
video This is a video advertisement that is played in the form of Pre-Roll before playing video content.
interstitialexpand When the app is launched, a full-page advertisement is posted, and the remaining area is filled with colors based on the top left hand corner 1 pixel.

SDK Library

Header file

Header file name Description
ManAdDefine.h MAN 2.0 / MANPLUS ad define header
AdBanner.h banner header
ManInterstitial.h interstitial header
ManMovieAdView.h video ad header
ManBreakAdInterstitial.h break interstitial header
JSONKit.h / JSONKit.m JSON parsing related file

Library file

Library file name Description
libManAdView.a MANPLUS ad library

Resource file

Resource file name Description
ManAdViewResource.bundle Device bundle resource
ManAdViewResource_Simulator.bundle Simulator bundle resource

MANPLUS SDK uses JSONKit files for JSON parsing, so you must include them for compilation. If your development project is already using JSONKit files, you do not need to include them.
(If JSONKit’s internal interface is not JSONDecoder, please use the JSONKit file included in the MANPLUS SDK.)

Sample composition

SDK sample project is included.
library path : ManAdSample/ManAdLibrary/…
GO to Sample Project

Framework for using SDK

Framework name Description
MediaPlayer.framework framework for video ad
CoreLocation.framework framework for getting location information
SystemConfiguration.framework framework for getting OS information
CoreTelephony.framework (status option - change ‘Required’ to ‘Optional’) framework for getting device information
AdSupport.framework (status option - change ‘Required’ to ‘Optional’) framework for getting IDFA

Framework, library files, and resource files added to the project

notice for SDK integration

About using IOS 9 ATS(App Transport Security) function
App Transport Security (ATS) functionality is provided on IOS9 and later.
Because HTTP method is restricted when ATS function is activated, normal MANPLUS ads are not exposed.

Please add the following items to the info.plist file.
Right-click in the info.plist file of the app to enter the edit mode using ‘Open As > Source Code’ and insert the code below.

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitararyLoads</key>
  <true/>
</dict>

If your app UI is special, you should write the string as delivered by MezzoMedia in the UITYPE in the ManAdDefine.h file.

banner(richmedia) applying

richmedia

  • ADBanner Richmedia is an HTML-type advertisement, not an image-type one.
  • The size 320x50 is set by the MANPLUS advertising policy and cannot be adjusted.

richmedia integration

Import ADBanner.h and apply <ADBannerDelegate> on viewController header where banner ad will be implemented. And declare ADbanner type object.
GO to Sample Project

ADBanner *manAdView;

ADBanner object setting – (required)

manAdView  =  [[ADBanner alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, MAN_AD_BANNER_HEIGHT)];
// Set issued Publisher ID, media ID, section ID
[manAdView publisherID:@"100" mediaID:@"200" sectionID:@"300"];

// Hand over the viewController object.
manAdView.delegate = self;
 
// Automatically adjust the horizontal size of the banner to the horizontal size of the device..
manAdView.autoresizingMask = UIViewAutoresizingFlexibleWidth;

banner ad option setting – (optional)

// ad operation setting
[manAdView useReachMedia:NO];  	// creative type (YES : html-type, NO : Image-type) 
[manAdView useGotoSafari:NO];	  // landing actions when ad is clicked (YES : Safari, NO : modal view)
    
[manAdView userAgeLevel:@"1"];  // u_age_level (Under 13 years of age : @"0", Over 13 years of age : @"1")<Recommended parameter>
[manAdView keywordParam:@"KeywordTargeting"]; // Function parameter for keyword targeting (Optional)
 
// user information setting
manAdView.gender = @"1";  // gender (male:@"1", female:@"2")
manAdView.age = @"15"; 	  // age
manAdView.userId = @"mezzomedia";                       // user ID
manAdView.userEmail = @"mezzomedia@mezzomedia.co.kr";   // user E-Mail
manAdView.userPositionAgree = @"1";       // GPS agreed (agree:@"1", disagree:@"0")

banner(imgae type) applying

Image type

  • ADBanner image is an image cut advertisement, not HTML rendering.
  • Unlike rich media type, you can resize by maintaining the ratio in horizontal and vertical. (Image type is recommended to correspond to resolution above iPhone 6.)

image type integration

Import ADBanner.h and apply <ADBannerDelegate> on viewController header where banner ad will be implemented. And declare ADbanner type object.
GO to Sample Project

ADBanner *manAdView;

ADBanner ad object setting – (required)

CGFloat bannerLimitHeight = 64.0f; 
CGFloat bannerFrameWidth = MIN(self.view.bounds.size.width, self.view.bounds.size.height);
CGFloat bannerFrameHeight = bannerFrameWidth / MAN_BANNER_RATIO;
bannerFrameHeight = (bannerFrameHeight > bannerLimitHeight)? bannerLimitHeight : bannerFrameHeight;
manAdView  =  [[ADBanner alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, bannerFrameHeight)];

// Set issued Publisher ID, media ID, section ID
[manAdView publisherID:@"100" mediaID:@"200" sectionID:@"300"];

// Hand over the viewController object.
manAdView.delegate = self;

// Automatically adjust the horizontal size of the banner to the horizontal size of the device..
manAdView.autoresizingMask = UIViewAutoresizingFlexibleWidth;

banner ad option setting – (optional)

// ad operation setting
[manAdView useReachMedia:NO];  	// creative type (YES : html-type, NO : Image-type) 
[manAdView useGotoSafari:NO];	  // landing actions when ad is clicked (YES : Safari, NO : modal-view)

[manAdView userAgeLevel:@"1"];  // u_age_level (Under 13 years of age : @"0", Over 13 years of age : @"1")<Recommended parameter>
[manAdView keywordParam:@"KeywordTargeting"]; // Function parameter for keyword targeting (Optional)

// user information setting
manAdView.gender = @"1";                 // gende (male:@"1", female:@"2")
manAdView.age = @"15";	                 // age
manAdView.userId = @"mezzomedia";        // user ID
manAdView.userEmail = @"mezzomedia@mezzomedia.co.kr";   // user E-Mail 
manAdView.userPositionAgree = @"1";       // GPS agreed (agree:@"1", disagree:@"0")

banner ad common

banner start

// banner ad start 
[manAdView startBannerAd];

// banner view applying
[self.view addSubview:manAdView];

Event implementing

Implementing events as ADBannerDelegate occurs

#pragma ADBannerDelegate
- (void) adBannerClick:(ADBanner*)adBanner {
  // banner ad click
}

- (void) adBannerParsingEnd:(ADBanner*)adBanner {
  // banner ad parsing complete
}

-(void) didReceiveAd:(ADBanner*)adBanner chargedAdType:(BOOL)bChargedAdType {
  // ad receive success and ad charge type (charged or non-charged)
  NSString *chargedAdType = nil;

  if (bChargedAdType) {
    chargedAdType = @"charged";
  } else {
    chargedAdType = @"non-charged";
  }
}

- (void) didFailReceiveAd:(ADBanner*)adBanner errorType:(NSInteger)errorType {
  // ad receive fail
  // Refer to ManAdDefine.h about errorTyped
}

- (void) didCloseRandingPage:(ADBanner*)adBanner {
  // Called when destination page that appears when banner ad is clicked is closed
}

Class description

ADBanner integration functions
Function Description
(void)publisherID:(NSString)publisherID
mediaID:(NSString
)mediaID
sectionID:(NSString*)sectionID
put publisherID, mediaID, sectionID issued by MezzoMedia
(void)useReachMedia:(BOOL)useFlag creative type
useFlag : Html type - YES, image type - NO
(void)useGotoSafari:(BOOL)useFlag Set how destination page will be displayed
useFlag : safari - YES, modal view - NO
(void)userAgeLevel:(NSString*)userAgeLevel User’s age level parameter (recommended)(Under 13 years of age : @”0”, Over 13 years of age : @”1”)
(void)keywordParam:(NSString*)param Send keyword value
Use delimiter as ^
Keyword values are encoded (Optional)
(void)startBannerAd Request banner ad. (Called when you force the replacement of banner ads)
ADBanner integration variables
Variable Description
id<ADBannerDelegate>delegate Pass ViewController Pointer to Attach Banner
manAdView.delegate = self;
NSString *gender user gender
male : @”1”, female : @”2”
manAdView.gender = @”1”
NSString *age user age
manAdView.age = @”20”
NSString *userId user ID
manAdView.userId = @”mezzo_user”
NSString *userEmail user e-mail
manAdView.userEmail = @”mezzo_user@mezzomedia.co.kr”
NSString *userPositionAgree GPS agreed
agree : @”1”, disagree : @”0”
manAdView.userPositionAgree = @”1”
ADBanner Delegate
Function Description
(void)adBannerClick:(ADBanner*)adbanner banner click event notice
(void)adBannerParsingEnd:(ADBanner*)adbanner Notify that ready to expose the advertisement
(void)didReceiveAd:(ADBanner*)adBanner chargedAdType:(BOOL)bChargedAdType ad receive success notice
bChargedAdType: charge type info, YES is charged, NO is non-charged.
(void)didFailReceiveAd:(ADBanner*)adBanner erorType:(NSInteger)errorType ad receive fail notice
errorType : Error code, the cause of ad failure. (Refer to error code)
(void)didCloseRandingPage:(ADBanner*)adbanner Notify when destination page that appears when banner ad is clicked is closed. (modal view only)

Interstitial banner applying

Interstitial banner integration

Import ManInterstitial.h and apply <ManInterstitialDelegate> on viewController header where interstitial ad will be implemented. And declare ManInterstitial type object.
GO to Sample Project

ManInterstitial *manInterstitial = [ManInterstitial shareInstance];

ManInterstitial object setting – (required)

// Set issued Publisher ID, media ID, section id
[manInterstitial publisherID:@"100" mediaID:@"200" sectionID:@"300"];

interstitial option setting – (optional)


[manInterstitial userAgeLevel:@"1"];  // u_age_level (Under 13 years of age : @"0", Over 13 years of age : @"1")<Recommended parameter>
[manInterstitial keywordParam:@"KeywordTargeting"]; // Function parameter for keyword targeting (Optional)

// user information setting
manInterstitial.gender = @"1";                  // gender (male:@"1", female:@"2")
manInterstitial.age = @"15";	                  // age
manInterstitial.userId = @"mezzomedia";         // user ID
manInterstitial.userEmail = @"mezzomedia@mezzomedia.co.kr";   // user E-Mail
manInterstitial.userPositionAgree = @"1";      // GPS agreed (agree:@"1", disagree:@"0")
manInterstitial.viewType = @"0";              //ui setting (full-page:@"0", pop-up:@2")

interstitial ad start

// interstitial ad start
[manInterstitial startInterstitial];

Implement events resulting from ManInterstitialDelegate.

#pragma mark ManInterstitialDelegate

-(void)didReceiveInterstitial {
    // interstitial receive success
}

-(void)didFailReceiveInterstitial :(NSInteger)errorType {
    // interstitial receive error
}

-(void)didCloseInterstitial {
    // interstitial close
}

-(void)didClickInterstitial {
    // interstitial click
}

Class description

ManInterstitial integration functions
Function Description
(ManInterstitial*)shareInstance; creating object of interstitial banner
(void)publisherID:(NSString)publisherID
mediaID:(NSString
)mediaID
sectionID:(NSString*)sectionID
put publisherID, mediaID, sectionID issued by MezzoMedia
(void)userAgeLevel:(NSString*)userAgeLevel User’s age level parameter (recommended)(Under 13 years of age : @”0”, Over 13 years of age : @”1”)
(void)keywordParam:(NSString*)param Send keyword value
Use delimiter as ^
Keyword values are encoded (Optional)
(void)startInterstitial Request interstitial ad, show interstitial ad
ManInterstitial integration functions
Variable Description
id<ManInterstitialDelegate>delegate Pass ViewController Pointer to Attach Banner
manInterstitial.delegate = self;
NSString *gender user gender
male : @”1”, female : @”2”
manInterstitial.gender = @”1”
NSString *age user age
manInterstitial.age = @”20”
NSString *userId user ID
manInterstitial.userId = @”mezzo_user”
NSString *userEmail user e-mail
manInterstitial.userEmail = @”mezzo_user@mezzomedia.co.kr”
NSString *userPositionAgree GPS agreed
agree : @”1”, disagree : @”0”
manInterstitial.userPositionAgree = @”1”
ManInterstitia Delegate
Function Description
(void)didReceiveInterstitial interstitial ad receive success
(void)didFailReceiveInterstitial:(NSInteger)errorType interstitial ad receive fail (refer to error code definition)
(void)didCloseInterstitial interstitial ad close
(void)didClickInterstitial interstitial ad click

Insert video ad

Video ad integration

Import ManMovieAdView.h and apply <ManMovieAdViewDelegate> on viewController header where video ad will be implemented. And declare ManMovieAdView type object.
GO to Sample Project

ManMovieAdView *manMovieAdView =  [[ManMovieAdView alloc]
initWithFrame:CGRectMake(0, 0, movieWidth, movieHeight)];

ManMovieAdView object setting – (required)

// Set issued Publisher ID, media ID, section id
[manMovieAdView publisherID:@"100" mediaID:@"200" sectionID:@"303"];

If ManMovieAddView frame is set when creating a video ad, ManMovieAddView frame must be set even when rotating horizontally or vertically.
If ManMovieAddView’s frame is not set, the player’s frame may look different as well..

Set video ad options - (optional setting)

// ad operation setting
[manMovieAdView useGotoSafari:NO];      // landing actions when ad is clicked (YES : Safari, NO : modal view)

[manMovieAdView userAgeLevel:@"1"];  // u_age_level (Under 13 years of age : @"0", Over 13 years of age : @"1")<Recommended parameter>
[manMovieAdView keywordParam:@"KeywordTargeting"]; // Function parameter for keyword targeting (Optional)

// category setting
manMovieAdView.categoryCD = @"00200";

// user information setting
manMovieAdView.gender = @"1"	            // gender (male:@"1", female:@"2")
manMovieAdView.age = @"15";	            // age
manMovieAdView.userId = @"mezzomedia";      // user ID
manMovieAdView.userEmail = @"mezzomedia@mezzomedia.co.kr";   // user E-Mail
manMovieAdView.userPositionAgree = @"1";    // GPS agreed (agree:@"1", disagree:@"0")

video ad play

// video ad view applying
[self.view addSubview:manMovieAdView];

// video ad start
[manMovieAdView startInterstitial];

Implement events as a result of ManMovieAddViewDelegate.

#pragma mark ManMovieAdViewDelegate
-(void)didReceiveMovieAd(ManMovieAdView*)manMovieAdView {
     // video ad receive success
}
-(void)didFailReceiveMovieAd(ManMovieAdView*)manMovieAd  (NSInteager)errorType 
{
     // video ad receive fail
}
-(void)didFinishMovieAd(ManMovieAdView*)manMovieAd {
     // video ad finish
}
-(void)didStopMovieAd(ManMovieAdView*)manMovieAd {
     //video ad play stop (exit during video ad play) 
}
-(void)didSkipMovieAd(ManMovieAdView*)manMovieAd {
     // video ad skip
}
-(void)didClickMovieAd(ManMovieAdView*)manMovieAd {
     // video ad click 
}
-(void)didNotExistMovieAd(ManMovieAdView*)manMovieAd {
    // no video ad
}
- (void)didCloseRandingPage:( ManMovieAdView*)manMovieAd {
      // destination page when ad is clicked is closed
}

Class description

ManMovieAd intergration functions
Function Description
(void)publisherID:(NSString)publisherID
mediaID:(NSString
)mediaID
sectionID:(NSString*)sectionID
put publisherID, mediaID, sectionID issued by MezzoMedia
(void)useGotoSafari:(BOOL)useFlag Set how destination page will be displayed useFlag : safari - YES, modal view - NO
(void)userAgeLevel:(NSString*)userAgeLevel User’s age level parameter (recommended)(Under 13 years of age : @”0”, Over 13 years of age : @”1”)
(void)keywordParam:(NSString*)param Send keyword value
Use delimiter as ^
Keyword values are encoded (Optional)
(void)startMovieAd video ad request
(void)stopMovieAd video ad stop
(void)setScreenMode:
(MOVIE_SCREEN_MODE)movieScreeMode
video screen mode
MODE_NORMAL : 4:3 screen
MODE_WIDE : 16:9 screen
MODE_STRECH : set the parent View
MODE_ORIGINAL : actual video size
ManMovieAd integration variables
Variable Description
id<ManMovieAdViewDelegate>delegate Pass ViewController Pointer to Attach Banner
manMovieAdView.delegate = self;
NSString *gender user gender
male : @”1”, female : @”2”
manMovieAdView.gender = @”1”
NSString *age user age
manMovieAdView.age = @”20”
NSString *userId user ID
manMovieAdView.userId = @”mezzo_user”
NSString *userEmail user e-mail
manMovieAdView.userEmail = @”mezzo_user@mezzomedia.co.kr”
NSString *userPositionAgree GPS agreed
agree : @”1”, disagree : @”0”
manMovieAdView.userPositionAgree = @”1”
ManMovieAdView Delegate
Function Description
(void)didReceiveMovieAd:(ManMovieAdView*)manMovieAd video ad receive success
(void)didFailReceiveMovieAd: (ManMovieAdView*)manMovieAderrorType:(NSInteger)errorType video ad receive fail. (refer to error code definition)
(void)didFinishMovieAd:(ManMovieAdView*)manMovieAd video ad finish
(void)didStopMovieAd:(ManMovieAdView*)manMovieAd video ad play stop (exit during video ad play)
(void)didSkipMovieAd:(ManMovieAdView*)manMovieAd video ad skip
(void)didClickMovieAd:(ManMovieAdView*)manMovieAd video ad click
(void)didNotExistMovieAd:(ManMovieAdView*)manMovieAd no video ad
(void)didCloseRandingPage:(ManMovieAdView*)manMovieAd destination page closed

error code definition

Code name Description
0 NewManAdSuccess success
-1002 NewManAdRequestError invalid ad request
-2002 NewManAdParameterError invalid parameter
-3002 NewManAdIDError incorrect publisher, media, section ID
-4002 NewManAdNotError no ad
-5002 NewManAdServerError ad server error
-6002 NewManAdNetworkError network error
-8001 NewManAdFileError creative file format error
-9001 NewManAdCreativeError creative request error

F & Q

check whether an ad is exposed successfully

No Description
1 Q. How to check if an advertisement is not exposed after applying SDK
  A1 : mobile device test
Check whether the Delegate function has been called for receipt of advertising and check the error codes of the receiving failure Delegate.(Refer to Delegate of each ad type)
  A2 : publisher side SDK applying error
Please heck that you entered the ID (publihser, media, section ID issued by MezzoMedia) correctly.
(If a video ad targets a category, make sure that the category code is applied correctly.)
  A3 : House campaign setting error
The error of advertising exposure after you set up an ad is largely due to the incorrect code or to the test code. Please check the setting.
If you are unable to see the commercial advertisement continuously, Please contact us.
2 Q. If there are no ads or free ads after the set of commercial advertisement
  A. For commercial advertisements, it is sent on time every hour, so please reconfirm on time.

handling No ad (passback)

No Description
1 Q. No ad handling questions
  A. Depending on the ad setting environment, No Ad occurs when the ads are out of stock. SDK calls receive failure Delegate (error code -4002) when No ad situation.
When that Delegate is called, you can request again for MANPLUS advertisement, call another platform’s ad, or play the main content (video).
2 Q. Why do I see the figures in the report even in the No ad situation?
  A. Even under No ad, the report number is normal, which is the call number for inventory check, not for actual exposure.

Updated: