如何制作Facebook广告? [英] How to make the Facebook ads live?
问题描述
我在我的iOS应用中添加了Facebook受众网络,以实现本机广告集成.一切正常,但只有测试广告.
I have added Facebook audience network in my iOS App for native ads integration. Everything is working fine but there are only testing ads.
我添加了testDeviceKey用于显示广告,如果我尝试删除它,则没有广告显示,这也让我感到困惑.我的代码是-
I have added testDeviceKey for displaying ads if I try to remove this then no ads are displaying that is also making me confused. My code is -
@implementation AdFeedsView
FBNativeAd *nativeAd;
static NSString *adPlacementId = @"xxxxxxxxx";
- (void)showNativeAd:(UIViewController *)vc
{
nativeAd = [[FBNativeAd alloc] initWithPlacementID:adPlacementId];
nativeAd.delegate = self;
NSLog(@"isTestMode1: %d",[FBAdSettings isTestMode]);
NSString *testDeviceKey = [FBAdSettings testDeviceHash];
if (testDeviceKey) {
[FBAdSettings addTestDevice:testDeviceKey];
}
[nativeAd loadAd];
}
所以我只想问一下我需要对代码进行哪些更改,以便除了在实时应用中测试广告之外,还可以看到适当的广告?
So I just want to ask that what changes should I need to do in my code so that we can see proper ads other than testing ads in my live app?
推荐答案
最后,我找到了解决方案.其实我已经添加了代码
Finally I find the solution. Actually I have added the code
NSString *testDeviceKey = [FBAdSettings testDeviceHash];
if (testDeviceKey) {
[FBAdSettings addTestDevice:testDeviceKey];
}
将所有活动设备都用作测试设备,因此仅存在测试广告.我已在实时版本中将其删除,并包含了代码
that is making all the active devices as testing devices hence there are only testing ads. I have removed it in the live version and included the code
[FBAdSettings clearTestDevices];
我们也可以
if ([FBAdSettings isTestMode]) {
[FBAdSettings clearTestDevice:[FBAdSettings testDeviceHash]];
}
我对 testmode 有错误的认识.我认为当我的应用上线时这将是错误的,但实际上它只是告诉该设备是否已添加为testdevice.
I have a wrong perception about testmode. I think that it will be false when my app become live but actually it just tell that the device has been added as testdevice or not.
这篇关于如何制作Facebook广告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!