Implementing the Unit Delegate Methods
Important
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
IAParentViewControllerForUnitController:
Parent view controller evaluation from a publisher, in order to render ads in full-screen / modal mode.
Example:
- (UIViewController * _Nonnull)IAParentViewControllerForUnitController:(IAUnitController * _Nullable)unitController {
return self; // in case 'self' is a UIViewController subclass;
}
Note
All other delegate methods of this protocol (interface) are optional.
User Click
IAAdDidReceiveClick:
This method will be invoked when user clicks an ad:
- (void)IAAdDidReceiveClick:(IAUnitController * _Nullable)unitController {
NSLog(@"ad did click");
}
Ad Impression
IAAdWillLogImpression:
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
IAUnitControllerWillPresentFullscreen:
This means that the transition to fullscreen mode will be performed.
Transition Notification
- (void)IAUnitControllerWillPresentFullscreen:(IAUnitController * _Nullable)unitController {
NSLog(@"ad will present fullscreen");
}
IAUnitControllerDidPresentFullscreen:
This means the transition to fullscreen already performed.
- (void)IAUnitControllerDidPresentFullscreen:(IAUnitController * _Nullable)unitController {
NSLog(@"ad did present fullscreen");
}
Future Transition from Fullscreen Notification
IAUnitControllerWillDismissFullscreen:
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
IAUnitControllerDidDismissFullscreen:
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
IAUnitControllerWillOpenExternalApp:
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");
}