Louis Waweru
Louis Waweru

Reputation: 3672

How to force an iAd not to load?

I am trying to test an alternate ad provider for times when didFailToReceiveAdWithError is called.

In the iOS simulator I keep getting the test iAd, so I don't know what happens when an iAd fails to load.

2011-12-01 04:56:11.601 App Name -[theViewController bannerViewDidLoadAd:]
2011-12-01 04:57:12.582 App Name -[theViewController bannerViewDidLoadAd:]
2011-12-01 04:58:13.580 App Name -[theViewController bannerViewDidLoadAd:]
2011-12-01 04:59:14.578 App Name -[theViewController bannerViewDidLoadAd:]
2011-12-01 05:00:15.581 App Name -[theViewController bannerViewDidLoadAd:]
2011-12-01 05:01:16.572 App Name -[theViewController bannerViewDidLoadAd:]
2011-12-01 05:02:17.574 App Name -[theViewController bannerViewDidLoadAd:]
2011-12-01 05:03:18.573 App Name -[theViewController bannerViewDidLoadAd:]
2011-12-01 05:04:19.570 App Name -[theViewController bannerViewDidLoadAd:]
2011-12-01 05:05:20.566 App Name -[theViewController bannerViewDidLoadAd:]
2011-12-01 05:06:21.567 App Name -[theViewController bannerViewDidLoadAd:]
2011-12-01 05:07:22.565 App Name -[theViewController bannerViewDidLoadAd:]
2011-12-01 05:08:23.563 App Name -[theViewController bannerViewDidLoadAd:]
2011-12-01 05:09:24.562 App Name -[theViewController bannerViewDidLoadAd:]
2011-12-01 05:10:25.559 App Name -[theViewController bannerViewDidLoadAd:]
2011-12-01 05:11:26.558 App Name -[theViewController bannerViewDidLoadAd:]
2011-12-01 05:12:59.340 App Name -[theViewController bannerViewWillLoadAd:]
2011-12-01 05:12:59.770 App Name -[theViewController bannerViewDidLoadAd:]

Is there a way to force an iAd to fail to receive an ad?

Upvotes: 0

Views: 1203

Answers (2)

zpasternack
zpasternack

Reputation: 17898

When running debug builds, you should see occasional errors. The iAd Programming Guide says:

While you are developing your application, iAd Network sends test advertisements to your application. To assist you in validating your implementation, the iAd Network occasionally returns errors to test your error handling code. You can also test your error handling support manually by turning your device’s wireless capability off.

I've definitely observed this behavior in my own apps. Or, like it says above, turn wireless off.

Upvotes: 2

Andrew
Andrew

Reputation: 3892

Theres no literal way to stop the iad simulation from sending an ad. The way I would do this is to put a random number generator with the code that sets up your ads. Have one value set up an iAd and another call the didFailToLoad method so your can test your new system.

Hope that helps

Upvotes: 0

Related Questions