iAd+Admob 混用,在收不到iAd广告的时候用admob,一旦收到iAd广告就把admob关闭。这样可以实现在不支持iAd的国家里,开启admob。并不需要判断国家。
判断方法有三点主要事项:
- 同时请求iAd和admob
- 如果收到iAd广告就把admob关了
- 收到admob广告5次了,说明到目前未知还是没有收到iAd,这样说明你收不到iAd广告就可以关闭iAd了
1 将目录admob sdk 加载入工程,在Xcode->TARGETS->Build Seetings->Linking->Other Linker Flags中添加 "-ObjC"
2 USE IN ARC ===>-fno-objc-arc
If your project is compiled with ARC, you'll need to disable it for the IASK files. You can do so by adding -fno-objc-arc in the "Compile Sources" phase. You can select all the relevant files at once with shift-click and then double-click in the Compiler Flags column to enter the text.
3.1 添加相关的Framework到库,在Xcode->TARGETS->Build Phases->Link Binary With Libraries中添加:
2 USE IN ARC ===>-fno-objc-arc
If your project is compiled with ARC, you'll need to disable it for the IASK files. You can do so by adding -fno-objc-arc in the "Compile Sources" phase. You can select all the relevant files at once with shift-click and then double-click in the Compiler Flags column to enter the text.
3.1 添加相关的Framework到库,在Xcode->TARGETS->Build Phases->Link Binary With Libraries中添加:
- AdSupport.framework
- AudioToolbox.framework
- AVFoundation.framework
- CoreGraphics.framework
- MessageUI.framework
- StoreKit.framework
- SystemConfiguration.framework
- libGoogleAdMobAds.a
- iAd.framework
- CoreTelephony.framework
3.2 6.12后还需要增加
- EventKitUI.framework
- EvnetKit.framework
3.3 cocos2dx需要多增加
- MediaPlayer.framework
- GameController.framework
4 修改添加广告支持的基类ADHelper
[eaglView addSubview:[ADHelper getInstance].view];