Iphone Admob(GoogleMobileAds 8.0.0)iOS SDK-未找到GadInterstitual API,如何使用GadInterstitual-示例代码?
以下行没有错误Iphone Admob(GoogleMobileAds 8.0.0)iOS SDK-未找到GadInterstitual API,如何使用GadInterstitual-示例代码?,iphone,xcode,admob,cocoapods,googlemobileads,Iphone,Xcode,Admob,Cocoapods,Googlemobileads,以下行没有错误 #import <GoogleMobileAds/GoogleMobileAds.h> #导入 但是没有一个Admob API检测到…它为所有Admob API提供了错误。检测到另一个SDK(Applovin)API 这里是截图。如何修复Admob/GoogleMobileAds Pod文件: AdMob刚刚对8.0.0进行了一次主要版本更新,并对API进行了一些更改 或者 使用pod'googlemobileadsdk',“~>7.69”将pod锁定到7.x
#import <GoogleMobileAds/GoogleMobileAds.h>
#导入
但是没有一个Admob API检测到…它为所有Admob API提供了错误。检测到另一个SDK(Applovin)API
这里是截图。如何修复Admob/GoogleMobileAds
Pod文件:
AdMob刚刚对8.0.0进行了一次主要版本更新,并对API进行了一些更改 或者
- 使用
pod'googlemobileadsdk',“~>7.69”将pod锁定到7.x
- 8.x迁移是否记录在
#import <GoogleMobileAds/GoogleMobileAds.h>
@interface AppController : NSObject <GADFullScreenContentDelegate>
@property(nonatomic, strong) GADInterstitialAd *interstitial;
//当您想显示全屏广告时,请致电ShowAdMobadFullScreen
-(void)showAdmobAdsFullScreen
{
if (self.interstitial) {
[self.interstitial presentFromRootViewController:self.viewController];
}
else
{
#ifdef COCOS2D_DEBUG
NSLog(@"\nAdmob Ad wasn't ready\n");
#endif
}
}
//admob代表
- (void)adDidPresentFullScreenContent:(id)ad {
#ifdef COCOS2D_DEBUG
NSLog(@"\nAdmob ad did present full screen content.\n");
#endif
}
- (void)ad:(id)ad didFailToPresentFullScreenContentWithError:(NSError *)error {
#ifdef COCOS2D_DEBUG
NSLog(@"Admob Ad failed to present full screen content with error %@.", [error localizedDescription]);
#endif
}
- (void)adDidDismissFullScreenContent:(id)ad {
[self loadAdmob_Ads];
#ifdef COCOS2D_DEBUG
NSLog(@"Admob Ad did dismiss full screen content.");
#endif
}
GoogleMobileAds 8.0(Admob iOS)中使用Gadald的示例
非常感谢,先生。
- (void)adDidPresentFullScreenContent:(id)ad {
#ifdef COCOS2D_DEBUG
NSLog(@"\nAdmob ad did present full screen content.\n");
#endif
}
- (void)ad:(id)ad didFailToPresentFullScreenContentWithError:(NSError *)error {
#ifdef COCOS2D_DEBUG
NSLog(@"Admob Ad failed to present full screen content with error %@.", [error localizedDescription]);
#endif
}
- (void)adDidDismissFullScreenContent:(id)ad {
[self loadAdmob_Ads];
#ifdef COCOS2D_DEBUG
NSLog(@"Admob Ad did dismiss full screen content.");
#endif
}
import UIKit
import GoogleMobileAds
class ViewController: UIViewController, GADFullScreenContentDelegate {
var ad: GADInterstitialAd!
override func viewDidLoad() {
super.viewDidLoad()
loadAd()
}
func loadAd() {
let id = "ca-app-pub-3940256099942544/4411468910"
GADInterstitialAd.load(withAdUnitID: id, request: GADRequest()) { ad, error in
if error != nil { return }
self.ad = ad
self.ad.fullScreenContentDelegate = self
self.ad.present(fromRootViewController: self)
}
}
func adDidPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) {
print("present-ads")
}
func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) {
print("dismiss-ads")
}
}