iOS Developer Library

Developer

iAd Framework Reference ADInterstitialAdDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

ADInterstitialAdDelegate

The ADInterstitialAdDelegate protocol is implemented by an object so that your application can respond to changes in an ADInterstitialAd object. An ad object calls its delegate whenever the state of the ad changes.

Inheritance


Not Applicable

Import Statement


Swift

import iAd

Objective-C

@import iAd;

Availability


Available in iOS 4.3 and later.
  • Called before the advertisement loads its content

    Declaration

    Swift

    optional func interstitialAdWillLoad(_ interstitialAd: ADInterstitialAd!)

    Objective-C

    - (void)interstitialAdWillLoad:(ADInterstitialAd *)interstitialAd

    Parameters

    interstitialAd

    The ad object that is about to load a new advertisement.

    Import Statement

    Objective-C

    @import iAd;

    Swift

    import iAd

    Availability

    Available in iOS 5.0 and later.

  • Called after the advertisement loads its content.

    Declaration

    Swift

    optional func interstitialAdDidLoad(_ interstitialAd: ADInterstitialAd!)

    Objective-C

    - (void)interstitialAdDidLoad:(ADInterstitialAd *)interstitialAd

    Parameters

    interstitialAd

    The ad object that loaded a new advertisement.

    Discussion

    Your application implements this method to be notified when the ad object has finished downloading its content from the iAd Network. Your application may not present an ad object until after it finishes loading its content.

    Import Statement

    Objective-C

    @import iAd;

    Swift

    import iAd

    Availability

    Available in iOS 4.3 and later.

  • Called after a full-screen ad disposes of its content. (required)

    Declaration

    Swift

    func interstitialAdDidUnload(_ interstitialAd: ADInterstitialAd!)

    Objective-C

    - (void)interstitialAdDidUnload:(ADInterstitialAd *)interstitialAd

    Parameters

    interstitialAd

    The interstitial ad that disposed of its content.

    Discussion

    An ad object may unload its content for a number of reasons, including such cases as when an error occurs, after a user dismisses an advertisement that was presented modally, or after an advertisement’s contents have been loaded for a long period of time. The ad object automatically removes its contents from the screen if it was already presented to the user. Your implementation of this method should release the ad object.

    Import Statement

    Objective-C

    @import iAd;

    Swift

    import iAd

    Availability

    Available in iOS 4.3 and later.

  • Called before an full-screen ad executes its action.

    Declaration

    Swift

    optional func interstitialAdActionShouldBegin(_ interstitialAd: ADInterstitialAd!, willLeaveApplication willLeave: Bool) -> Bool

    Objective-C

    - (BOOL)interstitialAdActionShouldBegin:(ADInterstitialAd *)interstitialAd willLeaveApplication:(BOOL)willLeave

    Parameters

    interstitialAd

    The ad that the user tapped.

    willLeave

    YEStrue if another application will be launched to execute the action; NOfalse if the action is going to be executed inside your application.

    Return Value

    Your delegate returns YEStrue if the banner action should execute; NOfalse to prevent the banner action from executing.

    Discussion

    When the user taps a presented advertisement, the ad’s delegate is called to inform your application that the user wants to interact with the ad. To allow the action to be triggered, your method should return YEStrue; to suppress the action, your method returns NOfalse. Your application should almost always allow actions to be triggered; preventing actions may alter the advertisements your application sees and reduce the revenue your application earns through iAd.

    If the value of the willLeave parameter is YEStrue and your delegate allows the advertisement to execute its action, then your application is moved to the background shortly after the call to this method completes.

    If the value of the willLeave parameter is NOfalse, the advertisement’s interactive experience will run inside your application. To accomodate the advertisement, your application should disable activities that require user interaction as well as disabling any tasks or behaviors that may interfere with the advertisement. For example, a game might pause its game play and turn off sound effects until the user finishes interacting with the advertisement. Further, while the action is running, your application should also be prepared to respond to low-memory warnings by disposing of objects it can easily recreate after the advertisement completes its action.

    Import Statement

    Objective-C

    @import iAd;

    Swift

    import iAd

    Availability

    Available in iOS 4.3 and later.

  • Called after an full-screen ad finishes executing its action.

    Declaration

    Swift

    optional func interstitialAdActionDidFinish(_ interstitialAd: ADInterstitialAd!)

    Objective-C

    - (void)interstitialAdActionDidFinish:(ADInterstitialAd *)interstitialAd

    Parameters

    interstitialAd

    The ad that finished executing an action.

    Discussion

    When your application is notified that the advertisement has finished executing its action, it should resume any activities it paused before allowing the action to run.

    Import Statement

    Objective-C

    @import iAd;

    Swift

    import iAd

    Availability

    Available in iOS 4.3 and later.

  • Called when an full-screen ad fails to load a new advertisement. (required)

    Declaration

    Swift

    func interstitialAd(_ interstitialAd: ADInterstitialAd!, didFailWithError error: NSError!)

    Objective-C

    - (void)interstitialAd:(ADInterstitialAd *)interstitialAd didFailWithError:(NSError *)error

    Parameters

    interstitialAd

    The full-screen ad that received the error.

    error

    The error object that describes the problem.

    Discussion

    Although the error message informs your application about why the error occurred, normally your application does not need to display the error to the user.

    When an error occurs, your delegate should release the ad object.

    Import Statement

    Objective-C

    @import iAd;

    Swift

    import iAd

    Availability

    Available in iOS 4.3 and later.