ADInterstitialAdDelegate Protocol Reference

Conforms to
Framework
/System/Library/Frameworks/iAd.framework
Availability
Available in iOS 4.3 and later.
Companion guide
Declared in
ADInterstitialAd.h
Related sample code

Overview

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.

Tasks

Detecting When Advertisements Are Loaded

Detecting When a User Interacts With an Advertisement

Detecting Errors

Instance Methods

interstitialAd:didFailWithError:

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

- (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.

Availability
  • Available in iOS 4.3 and later.
Declared In
ADInterstitialAd.h

interstitialAdActionDidFinish:

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

- (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.

Availability
  • Available in iOS 4.3 and later.
Declared In
ADInterstitialAd.h

interstitialAdActionShouldBegin:willLeaveApplication:

Called before an full-screen ad executes its action.

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

The ad that the user tapped.

willLeave

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

Return Value

Your delegate returns YES if the banner action should execute; NO 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 YES; to suppress the action, your method returns NO. 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 YES 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 NO, 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.

Availability
  • Available in iOS 4.3 and later.
Declared In
ADInterstitialAd.h

interstitialAdDidLoad:

Called after the advertisement loads its content.

- (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.

Availability
  • Available in iOS 4.3 and later.
Declared In
ADInterstitialAd.h

interstitialAdDidUnload:

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

- (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.

Availability
  • Available in iOS 4.3 and later.
Declared In
ADInterstitialAd.h

interstitialAdWillLoad:

Called before the advertisement loads its content

- (void)interstitialAdWillLoad:(ADInterstitialAd *)interstitialAd
Parameters
interstitialAd

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

Availability
  • Available in iOS 5.0 and later.
Declared In
ADInterstitialAd.h