Pat Whitehead
Pat Whitehead

Reputation: 105

iAd didFailToReceiveAdWithError always called

I'm using iAd in my root view controller (map-based app) and every time I move to a new view controller after tapping an annotation or button on the toolbar, didFailToReceiveAdWithError is called.

This is the "error" I'm receiving:

Error Domain=ADErrorDomain Code=0 "The operation couldn’t be completed. Unknown error" UserInfo=0x251ba2d0 {ADInternalErrorCode=7, ADInternalErrorDomain=ADErrorDomain, NSLocalizedFailureReason=Unknown error}

Is this normal? And if so, is there any way for this to be disabled?

Upvotes: 4

Views: 1567

Answers (1)

morningstar
morningstar

Reputation: 9162

If you're moving to a screen where the ad can't be seen, you are recommended to disable the ad. Then you shouldn't have any possibility to fail to receive it. Remove it from the superview, set the delegate to nil, and release it. Create it again when it will be visible again.

It runs counter to the way you usually do things in Cocoa to have to specifically clean up stuff in screens you're moving away from, but that's how you're supposed to do it for iAd.

Upvotes: 3

Related Questions