如何在不需要时真正关闭 iAds?
我正在使用 iAds 构建一个付费应用程序和一个附带的精简版。付费版本时不时地在日志中显示此错误:
2011-09-12 15:05:24.751 [29318:12b03] ViewController::bannerView didFailToReceiveAdWithError (NO ADS):Error Domain=ADErrorDomain Code=3 “操作无法”广告资源不可用” UserInfo=0x61d0b60 {ADInternalErrorCode=3, NSLocalizedFailureReason=广告库存不可用}
我对发生这种情况感到有点惊讶,因为我这样做是为了停止付费版本中的 iAd:
[iAdBannerView removeFromSuperview];
iAdBannerView.hidden = YES;
// (not setting) iAdBannerView.delegate = nil;
iAdBannerView = nil;
我无法删除应用程序中对 iAd 的所有引用,因为我的笔尖中有 iAd 横幅,并且对于两个应用程序版本,我更喜欢一个笔尖包含所有内容。因此,iAd 框架位于我的二进制文件中。
那么,有人知道如何真正停止为您的应用启动 iAds 系统吗?
I'm building a paid app and an accompanying lite version with iAds. The paid version now and then displays this error in the log:
2011-09-12 15:05:24.751 [29318:12b03] ViewController::bannerView didFailToReceiveAdWithError (NO ADS):Error Domain=ADErrorDomain Code=3 "The operation couldn’t be completed. Ad inventory unavailable" UserInfo=0x61d0b60 {ADInternalErrorCode=3, NSLocalizedFailureReason=Ad inventory unavailable}
I'm a bit surprised this happens, as I am doing this to stop iAds in the paid version:
[iAdBannerView removeFromSuperview];
iAdBannerView.hidden = YES;
// (not setting) iAdBannerView.delegate = nil;
iAdBannerView = nil;
I cannot remove every reference to iAds in my app, as I have the iAd banner in a nib, and I prefer to have one nib with everything in it, for both app version. Hence the iAd framework is in my binary.
So, anyone an idea how to really stop the iAds system starting for your app when it should not?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您要向 AppStore 提交两个单独的应用程序,我会认真考虑在 Xcode 和用户条件编译上为每个应用程序创建一个单独的目标。
像这样:
这样,您的付费版本甚至不必链接到 iAd 框架,也不会因为您引入应用程序的错误而冒付费用户看到广告的风险。
If you are to submit two separate apps to the AppStore, I would seriously consider creating a separate target for each on Xcode and user conditional compilation.
Something like this:
That way, your paid version doesn't even have to link to the iAd framework nor you risk a a paid user seeing an ad because of a bug you introduce to the app.
您可以使用预处理器命令从应用程序的付费版本中删除 iAd。
在您的 prefix.pch 中,您应包含如下内容:
#define FREE_VERSION 1
然后在引用 iAd 的所有位置,用
#if FREE_VERSION
和# 将其括起来结束符
You could use preprocessor commands to strip iAds from the paid version of your application.
In your prefix.pch you'd include something like this:
#define FREE_VERSION 1
And then everywhere where you reference iAds, surround it with
#if FREE_VERSION
and#endif