views:

159

answers:

1

What is the best-practice for placing ads in your table view cells? Here's my code, which works until the banner receives the transitionToNextBanner event, which then crashes my app.

UITableViewCell *cell = [tableVw dequeueReusableCellWithIdentifier:@"BannerAdCellIdentifier"];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"BannerAdCellIdentifier"] autorelease];
}
[[cell viewWithTag:9999] removeFromSuperview];

ADBannerView *adView = [[ADBannerView alloc] initWithFrame:CGRectMake(0, 0, 320, 50)];
adView.tag = 9999;
adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifier320x50];
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;
[cell addSubview:adView];
[adView release];

return cell;

I thought since I'm not setting the ad's delegate that this would be safe from any memory-related issues.

A: 

Apple will very likely reject your application if you place iAd banners within table view cells. The reason being that table view cells have the ability to move on and off screen multiple times (sometimes resulting in recreating/reloading the cell or its contents).

Since iAds pay out both per click and per impression, this would be an easy way to generate a lot of impressions and get more money through impressions. Apple aren't going to allow this.

The iAd guidelines state that iAd banners should be in a fixed spot, and not within a scroll view. It also states that if an iAd fails to load for whatever reason, your app shouldn't leave a blank space where it would have been. The last point may be purely aesthetic, I don't know.

Jasarien
Damn. You're right. Thanks.
E-Madd