我在iOS应用中添加了facebook原生广告,广告显示,但是当我点击广告时没有回复,没有详细弹出广告内容,有什么问题?
FBNativeAd *nativeAd = [[FBNativeAd alloc] initWithPlacementID:fanID];
nativeAd.delegate = self;
[nativeAd loadAd];
- (void)nativeAdDidLoad:(FBNativeAd *)nativeAd{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
NSData *iconImageData = [NSData dataWithContentsOfURL:nativeAd.icon.url];
NSData *coverImageData = [NSData dataWithContentsOfURL:nativeAd.coverImage.url];
dispatch_async(dispatch_get_main_queue(), ^{
int adViewCount = (int32_t)[_nativeAdViewArr count];
[self genAdScrollView];
PCNativeAdView *adView = [PCNativeAdView initWithNib];
CGRect rect = adView.frame;
rect.origin.x = (rect.size.width + 10)*adViewCount;
adView.frame = rect;
[_adScrollView addSubview:adView];
[_nativeAdViewArr addObject:adView];
[_adScrollView setContentSize:CGSizeMake((rect.size.width + 10)*(adViewCount + 1), 189)];
adView.adIconImageView.image = [UIImage imageWithData:iconImageData];
adView.adCoverImageView.image = [UIImage imageWithData:coverImageData];
adView.adTitleLabel.text = nativeAd.title;
adView.adBodyLabel.text = nativeAd.body;
adView.adSocialContextLabel.text = nativeAd.socialContext;
NSLog(@"Register UIView for impression and click...");
[nativeAd registerViewForInteraction:adView
withViewController:self];
if ([_nativeAdViewArr count] == 3)
{
[self reloadSubViewRect:-1];
}
});
});
}
需要保留FBNativeAd实例,我使用了NSMutableArray保存
答案 0 :(得分:3)
需要保留FBNativeAd实例,我使用NSMutableArray保存了实例。