PMBannerAdViewDelegate

Document created by david.simerly on Nov 6, 2017Last modified by david.simerly on Nov 9, 2017
Version 5Show Document
  • View in full screen mode
Conforms toNSObject
Declared inPMBannerAdViewDelegate.h

 

Overview

Protocol for interaction with the PMBannerAdView.

 

The entire protocol is optional. Some methods override default behavior and some are required to get full support for MRAID 2 ad content (saving calendar entries or pictures).

 

All messages are guaranteed to occur on the main thread. If any long running tasks are needed in reponse to any of the sent messages then they should be executed in a background thread to prevent and UI delays for the user.

 

Ad Updates

Internal Browser Events

Rich Media Ad Events

 

Instance Methods

bannerAdView:didFailToReceiveAdWithError:

Sent on error during ad download or render.

- (void)bannerAdView:(PMBannerAdView *)adView didFailToReceiveAdWithError:(NSError *)error

Parameters

adView

The PMBannerAdView instance sending the message.

error

The error encountered while attempting to receive or render the ad.

Declared In

PMBannerAdViewDelegate.h

 

bannerAdView:didProcessRichmediaRequest:

Sent after the SDK processes a richmedia event.

- (void)bannerAdView:(PMBannerAdView *)adView didProcessRichmediaRequest:(NSURLRequest *)event

Parameters

adView

The PMBannerAdView instance sending the message.

event

The NSURLRequest containing the event request.

Discussion

Applications can use this to react to various events if necessary but the SDK will have already processed them as necessary (expanded in result of an expand request).

Do not attempt to implement the specified event. The SDK will have already processed the event. See the IAB MRAID 2 specification on the event types.

Declared In

PMBannerAdViewDelegate.h

 

bannerAdView:didResizeToFrame:

Sent after the ad content is resized in response to a richmedia resize event.

- (void)bannerAdView:(PMBannerAdView *)adView didResizeToFrame:(CGRect)frame

Parameters

adView

The PMBannerAdView instance sending the message.

frame

The frame relative to the window where the resized content is displayed.

Discussion

The ad view itself is not resized, instead a new window is displayed with the resized ad content.

Declared In

PMBannerAdViewDelegate.h

 

bannerAdView:shouldOpenURL:

Sent when an ad will open a URL.

- (BOOL)bannerAdView:(PMBannerAdView *)adView shouldOpenURL:(NSURL *)url

Parameters

adView

The PMBannerAdView instance sending the message.

url

The URL to open.

Return Value

YES Allow the SDK to open the link with UIApplication’s openURL: or the internal browser.

NO Ignore the request

Discussion

Not implementing this method behaves as if YES was returned.

Declared In

PMBannerAdViewDelegate.h

 

bannerAdView:shouldPlayVideo:

Sent when an ad attempts to play a video in an external player.

- (BOOL)bannerAdView:(PMBannerAdView *)adView shouldPlayVideo:(NSString *)videoURL

Parameters

adView

The PMBannerAdView instance sending the message.

videoURL

The URL string of the video to play.

Return Value

NO Do not open the URL and play the video.

YES Invoke UIApplication openURL: to play the video.

Discussion

The default is to open the URL and play the video.

Developers can use an application player and return NO to play the video directly.

Declared In

PMBannerAdViewDelegate.h

 

bannerAdView:shouldSaveCalendarEvent:inEventStore:

Sent when a richmedia ad attempts to create a new calendar entry.

- (BOOL)bannerAdView:(PMBannerAdView *)adView shouldSaveCalendarEvent:(EKEvent *)event inEventStore:(EKEventStore *)eventStore

Parameters

adView

The PMBannerAdView instance sending the message.

event

The event to save.

eventStore

the store to save the event too.

Return Value

NO Do not attempt to add the calendar event.

YES Present the calendar event editor to the user to allow them to edit and save or cancel the event.

Discussion

Application developers can implement the dialog directly if desired by capturing the event and eventStore and returning nil. If not implemented the SDK will ignore the request.

Declared In

PMBannerAdViewDelegate.h

 

bannerAdView:shouldSavePhotoToCameraRoll:

Sent when a richmedia ad attempts to save a picture to the camera roll.

- (BOOL)bannerAdView:(PMBannerAdView *)adView shouldSavePhotoToCameraRoll:(UIImage *)image

Parameters

adView

The PMBannerAdView instance sending the message.

image

The image to save.

Return Value

NO Do not save the image to the camera roll.

YES Attempt to save the image to the camera roll.

Discussion

Application developers should implement this by prompting the user to save the image and then saving it directly and returning NO from this delegate method. If not implemented the image will NOT be saved to the camera roll.

iOS 6 added privacy options for applications saving to the camera roll. The user will be prompted by iOS on the first attempt at accessing the camera roll. If the user selects No then pictures will not be saved to the camera roll even if this method is implemented and returns YES.

Declared In

PMBannerAdViewDelegate.h

 

bannerAdView:willResizeToFrame:

Sent before the ad content is resized in response to a richmedia resize event.

- (void)bannerAdView:(PMBannerAdView *)adView willResizeToFrame:(CGRect)frame

Parameters

adView

The PMBannerAdView instance sending the message.

frame

The frame relative to the window where the resized content is displayed.

Discussion

The ad view itself is not resized, instead a new window is displayed with the resized ad content.

Declared In

PMBannerAdViewDelegate.h

 

bannerAdViewCloseButtonPressed:

Sent when the user selects the close button.

- (void)bannerAdViewCloseButtonPressed:(PMBannerAdView *)adView

Parameters

adView

The PMBannerAdView instance sending the message.

Discussion

This only occurs for the close button enabled with setCloseButton:afterDelay: or in the case of a interstitial richmedia ad that closes itself. It will not be sent for richmedia close buttons that collapse expanded or resized ads.

The common use case is for interstitial ads so the developer will know when to call closeInterstitial.

Declared In

PMBannerAdViewDelegate.h

 

bannerAdViewCustomCloseButton:

Implement to return a custom close button.

- (UIButton *)bannerAdViewCustomCloseButton:(PMBannerAdView *)adView

Parameters

adView

The PMBannerAdView instance sending the message.

Return Value

UIButton instance.

Discussion

This button will be used for richmedia ads if the richmedia ad does not indicate it has its own custom close button. It is also used if showCloseButton:afterDelay: enables the close button.

Do not return the same UIButton instance to different adView instances.
Be sure to add action handlers to the button as it will be reused and may persist beyond the handler's lifetime.

Declared In

PMBannerAdViewDelegate.h

 

bannerAdViewDidCollapse:

Sent after ad content collapes, expands or resizes.

- (void)bannerAdViewDidCollapse:(PMBannerAdView *)adView

Parameters

adView

The PMBannerAdView instance sending the message.

Declared In

PMBannerAdViewDelegate.h

 

bannerAdViewDidExpand:

Sent after the ad content expands in response to a richmedia expand event.

- (void)bannerAdViewDidExpand:(PMBannerAdView *)adView

Parameters

adView

The PMBannerAdView instance sending the message.

Discussion

The ad view itself is not expanded, instead a new window is displayed with the expanded ad content.

Declared In

PMBannerAdViewDelegate.h

 

bannerAdViewDidRecieveAd:

Sent after an ad successfully downloads and renders.

- (void)bannerAdViewDidRecieveAd:(PMBannerAdView *)adView

Parameters

adView

The PMBannerAdView instance sending the message.

Declared In

PMBannerAdViewDelegate.h

 

 

bannerAdViewInternalBrowserDidClose:

Sent after the internal browser closes.

- (void)bannerAdViewInternalBrowserDidClose:(PMBannerAdView *)adView

Parameters

adView

The PMBannerAdView instance sending the message.

Declared In

PMBannerAdViewDelegate.h

 

bannerAdViewInternalBrowserDidOpen:

Sent after the internal browser opens.

- (void)bannerAdViewInternalBrowserDidOpen:(PMBannerAdView *)adView

Parameters

adView

The PMBannerAdView instance sending the message.

Declared In

PMBannerAdViewDelegate.h

 

bannerAdViewInternalBrowserWillClose:

Sent before the internal browser closes.

- (void)bannerAdViewInternalBrowserWillClose:(PMBannerAdView *)adView

Parameters

adView

The PMBannerAdView instance sending the message.

Declared In

PMBannerAdViewDelegate.h

 

bannerAdViewInternalBrowserWillOpen:

Sent before the internal browser opens.

- (void)bannerAdViewInternalBrowserWillOpen:(PMBannerAdView *)adView

Parameters

adView

The PMBannerAdView instance sending the message.

Declared In

PMBannerAdViewDelegate.h

 

bannerAdViewPresentationController:

Allows the application to override the controller used to present modal controllers.

- (UIViewController *)bannerAdViewPresentationController:(PMBannerAdView *)adView

Parameters

adView

The PMBannerAdView instance sending the message.

Return Value

UIViewController to use as the presenting view controller for any SDK modal view controller.

Discussion

The SDK by default will use the application’s rootViewController property to display modal dialogs. These include richmedia expand, internal browser and calendar event creation. To override using this controller implement this message and return the view controller that can be used to present modal view controllers.

Application’s SHOULD have a rootViewController set but the iOS SDK will allow an application to run without one. If the application can not set up the rootViewController as expected then this method MUST be implemented to return a view controller that can be used to present modal dialogs. Without one certain SDK features will not work including showInterstitial, richmedia expand and the internal browser.

Declared In

PMBannerAdViewDelegate.h

 

bannerAdViewResizeSuperview:

Allows the application to override the superview used for ad resizing and visibility.

- (UIView *)bannerAdViewResizeSuperview:(PMBannerAdView *)adView

Parameters

adView

The PMBannerAdView instance sending the message.

Return Value

UIView to use as the superview when placing the resize view container.

Discussion

The supplied view MUST be a superview in the hierarchy to the PMBannerAdView instance.

The SDK by default will attempt to find a suitable default using the PMBannerAdView instance’s window’s rootViewController view, the application’s keyWindow rootViewController’s view and finally the PMBannerAdView’s superview.

Application’s SHOULD have a rootViewController set for the application window but the iOS SDK will allow an application to run without one. If the application can not set up the rootViewController as expected then this method MUST be implemented to return a view controller that can be used for resizing. Without one set the resize feature may not work correctly.

Declared In

PMBannerAdViewDelegate.h

 

bannerAdViewSupportsCalendar:

Allows developers to override calendar support.

- (BOOL)bannerAdViewSupportsCalendar:(PMBannerAdView *)adView

Parameters

adView

The PMBannerAdView instance sending the message.

Return Value

NO Informs richmedia ads that calendar access is not supported.

YES Informs richmedia ads that calendar access is supported.

Discussion

Implement to indicate if calendar events can be created. The default behavior is to NOT allow calendar access.

See Also

[PMBannerAdViewDelegate bannerAdView:shouldSaveCalendarEvent:inEventStore:]

Declared In

PMBannerAdViewDelegate.h

 

bannerAdViewSupportsPhone:

Allows developers to override phone support.

- (BOOL)bannerAdViewSupportsPhone:(PMBannerAdView *)adView

Parameters

adView

The PMBannerAdView instance sending the message.

Return Value

NO Informs richmedia ads that phone calls is not supported.

YES Informs richmedia ads that phone calls is supported.

Discussion

If the device supports phone dialling this message will be sent to allow the developer to override support. The default behavior is to allow phone dialing.

This message is not sent of the device does not support phone dialing.

Declared In

PMBannerAdViewDelegate.h

 

bannerAdViewSupportsSMS:

Allows developers to override SMS support.

- (BOOL)bannerAdViewSupportsSMS:(PMBannerAdView *)adView

Parameters

adView

The PMBannerAdView instance sending the message.

Return Value

NO Informs richmedia ads that SMS is not supported.

YES Informs richmedia ads that SMS is supported.

Discussion

If the device supports SMS this message will be sent to allow the developer to override support. The default behavior is to allow SMS usage.

This message is not sent of the device does not support SMS.

Declared In

PMBannerAdViewDelegate.h

 

bannerAdViewSupportsStorePicture:

Allows developers to override picture storing support.

- (BOOL)bannerAdViewSupportsStorePicture:(PMBannerAdView *)adView

Parameters

adView

The PMBannerAdView instance sending the message.

Return Value

NO Informs richmedia ads that storing pictures is not supported.

YES Informs richmedia ads that storing pictures is supported.

Discussion

Implement to indicate if storing pictures is supported. The default behavior is to NOT allow storing of pictures.

Declared In

PMBannerAdViewDelegate.h

 

bannerAdViewWillCollapse:

Sent before ad content collapses, expands, or resizes.

- (void)bannerAdViewWillCollapse:(PMBannerAdView *)adView

Parameters

adView

The PMBannerAdView instance sending the message.

Declared In

PMBannerAdViewDelegate.h

 

bannerAdViewWillExpand:

Sent before the ad content expands in response to a richmedia expand event.

- (void)bannerAdViewWillExpand:(PMBannerAdView *)adView

Parameters

adView

The PMBannerAdView instance sending the message.

Discussion

The ad view itself is not expanded, instead a new window is displayed with the expanded ad content.

Declared In

PMBannerAdViewDelegate.h

 

bannerAdViewWillLeaveApplication:

Sent before the ad opens a URL that invokes another application (Safari or App Store, for example).

- (void)bannerAdViewWillLeaveApplication:(PMBannerAdView *)adView

Parameters

adView

The PMBannerAdView instance sending the message.

Declared In

PMBannerAdViewDelegate.h

Attachments

    Outcomes