iOS SDK FAQ

Use the following method with the desired size:

(void)setDefaultImageSize:(nonnull NSString *)size;

I need to play Audio Ads along with Dialogue Ads. What I need to do?

Just use

[_adman prepareWithType:AdmanTypeAny];

instead of

[_adman prepareWithType:AdmanTypeVoice];

How to handle AdmanStateError state?

In case of an error, you will receive AdmanStateError state. Please find the ways to handle it below:

general SDK errors handler
- (void)admanStateDidChange:(Adman *)sender {
switch (sender.state) {
case AdmanStateError:
do_something();
break;
default:
break;
}
}
// to get detailed error info (if needed)
- (void)errorReceived:(nullable NSError *) error {
do_something();
}

How to handle ad preloading?

When using the ad preloading, it is necessary to call the method [adman reportAdEvent:@"can_show"]; at the time of possible launch of advertising, even in cases, when advertising wasn't actually loaded or played.

This method provides the measurement of advertising capacity.

How to create two instances of Adman with different regions?

Please find the example below:

(void)init {
self.admanEU = [[Adman alloc] initWithSiteId:777 testMode:NO withZoneId:0 region:AdmanRegionEU playerId:0];
self.admanEU.delegate = self;
self.admanUS = [[Adman alloc] initWithSiteId:778 testMode:NO withZoneId:0 region:AdmanRegionGlobal playerId:0];
self.admanUS.delegate = self;
}
-(void)admanStateDidChange:(Adman *)sender {
switch (sender.state) {
case AdmanStateAdNone:
if ([sender currentRegion] == AdmanRegionEU)
[_admanUS prepare];
default:
break;
}
}

How to call an ad with specific slot?

In order to specify the slot for an ad, the below method should be called before calling prepare

[setAdSlot:SlotName]

Possible values for SlotName:

Value Name

Description

AdmanPreroll

Will play only ads that should be played before the content or ads without specific slot.

AdmanMidroll

Will play only ads that should be played in the middle of the content or ads without specific slot.

AdmanPostroll

ill play only ads that should be played after the content or ads without specific slot.

How to change the look of the DefaultView?

Background color can be changed using the following method:

- (void)setBackgroundColor:(nonnull UIColor *)backgroundColor;

Font color can be changed using the following method:

- (void)setTextColor:(nonnull UIColor *)textColor;

Buttons color can be changed using the following method:

- (void)setBackgroundColor:(nonnull UIColor *)backgroundColor forButton:(AdmanUIButton)button;

Buttons text color can be changed using the following method:

- (void)setTitleColor:(nonnull UIColor *)color forButton:(AdmanUIButton)button;

For custom button the following method can be used:

- (void)setCustomControlIcon:(nullable AdmanUICustomIcon *)icon forButton:(AdmanUIButton)button;

How to set the size of Ad View?

You can use the following method in order to change the size and position of the Ad View:

setViewMaxBounds(x, y, width, height)

In the parameters you need to set the position and size of the desired Ad View.

Please find the usage example HERE

If you need to send Consent String in order to use IAB Europe Transparence and Consent Framework, use the following parameter:

consentString:(nullable NSString *)

This parameter must be used with 'prepare' method when you are preloading an ad. Please find some usage examples below:

- (void)prepare:(nullable NSString *)consentString;
- (void)prepareWithFormat:(AdmanFormat)format consentString:(nullable NSString *)userData;
- (void)prepareWithType:(AdmanType)type consentString:(nullable NSString *)userData;
- (void)prepare:(AdmanFormat)format type:(AdmanType)type consentString:(nullable NSString *)userData;
- (void)prepareWithAdLimits:(NSInteger)maxDuration adsCount:(NSInteger)adsCount consentString:(nullable NSString *)userData;
- (void)prepare:(AdmanFormat)format type:(AdmanType)type maxDuration:(NSInteger)maxDuration adsCount:(NSInteger)adsCount consentString:(nullable NSString *)userData;

How to customize the look of the ad view?

First of all, you need to import AdmanUIBase.h header. Then, after Adman initialisation you will need to create AdmanUIBase class.

This class must be initialised before calling [Adman prepare]

On the ad playback, the following method should be called:

[AdmanUIBase show:viewController]

In order to customize the look of the view, you will need to inherit the AdmanUIBase classe and implement its shared methods:

###AdmanUINew.h
```
@interface AdmanUIExtension : AdmanUIBase
@end
```
Adman.m
```
@implementation AdmanUIExtension
- (id)init {
self = [super init];
if (self) {
}
return self;
}
/**
Interface initialisation method
*/
- (void)initBaseView {
[super initBaseView];
}
/**
This method is used to show the default view
*/
- (void)show:(UIViewController *)rootVC {
[super show:rootVC];
}
/**
Thos method is used to process Adman motification.
Class AdmanUIBase is subscribed to all 3 types of notifications.
*/
- (void)admanVoiceNotification:(NSNotification *)notification {
[super admanVoiceNotification:notification];
NSDictionary *dict = notification.userInfo;
NotificationAdmanVoice *message = [dict valueForKey:NOTIFICATION_ADMAN_VOICE_KEY];
if (message == nil)
return;
switch (message.event) {
case AdmanVoiceEventRecognizerStarted:{
break;
}
default:
break;
}
}
@end
```