Unit Delegate Protocol

Implementing the Unit Delegate Methods


IAParentViewControllerForUnitController:unitController is a required delegate method.
When an ad transits to full-sreen, IASDK will need to get a "parent" view controller, and this method will be invoked. If it is not implemented, the app will crash with an exception, intentionally, to show that there is a required method implementation is missing.

This delegate method is required to get a client-side view controller to present modal views, such as in-app browser, storekit controller, MRAID expand, etc. In this method, a desired view controller should be returned by the client side. In most cases it will be the same view controller that presents an ad. 

Parent View Controller

Parent view controller evaluation from a publisher, in order to render ads in full-screen / modal mode.

Example Code
- (UIViewController * _Nonnull)IAParentViewControllerForUnitController:(IAUnitController * _Nullable)unitController {
  return self; // in case 'self' is a UIViewController subclass;


All other delegate methods of this protocol (interface) are optional.

User Click

This method will be invoked when user clicks an ad:

Example Code
- (void)IAAdDidReceiveClick:(IAUnitController * _Nullable)unitController {
  NSLog(@"ad did click");

Ad Impression

This method will be invoked when ad is rendered and visible:

Ad Impression Method

- (void)IAAdWillLogImpression:(IAUnitController * _Nullable)unitController {
  NSLog(@"ad impression");

Future Fullscreen Transition Notification

This means that the transition to fullscreen mode will be performed.

Transition Notification

- (void)IAUnitControllerWillPresentFullscreen:(IAUnitController * _Nullable)unitController {
  NSLog(@"ad will present fullscreen");
Notification of Performed Fullscreen Transition

This means the transition to fullscreen already performed.

Notification of Successful Transition
- (void)IAUnitControllerDidPresentFullscreen:(IAUnitController * _Nullable)unitController {
  NSLog(@"ad did present fullscreen");

Future Transition from Fullscreen Notification

This means that the transition from fullscreen mode will happen.

Future Fullscreen Transition

(void)IAUnitControllerWillDismissFullscreen:(IAUnitController * _Nullable)unitController {
  NSLog(@"ad will dismiss fullscreen");

Notification of Performed Transition from Fullscreen Mode

This means that the transition from fullscreen mode already performed.

Successfully Performed Transition

(void)IAUnitControllerDidDismissFullscreen:(IAUnitController *_Nullable)unitController {
  NSLog(@"ad did dismiss fullscreen");

Opening an External App Notification

This is a notification that your app will move to the background, and an external app such as Safari, the App Store, or a Universal link-supported app will open.

Notifying of Opening an External App

(void)IAUnitControllerWillOpenExternalApp:(IAUnitController *_Nullable)unitController {
  NSLog(@"ad will open external app");