여러 자습서를 사용해 보았지만 여러 곳에서 코드를 사용해 보았지만 Google Adob을 통해 어떤 일도 할 수 없었습니다. 시뮬레이터에서 오류가없고 프로젝트 빌드가 실행됩니다. 디버거에는 광고가로드되지 않고 메시지도 표시되지 않습니다. 기본적으로 아무 것도 일어나지 않습니다.ios8 응용 프로그램에서 작동하도록 admob을 얻을 수 없습니다.
나는 내 viewcontroller.h
에
[FIRApp configure];
[GADMobileAds configureWithApplicationID:@"ca-app-pub-5601547953982889~9365662253"];
을 넣었습니다
#import <GoogleMobileAds/GoogleMobileAds.h>
#import <GoogleMobileAds/GADBannerView.h>
#import <GoogleMobileAds/GADBannerViewDelegate.h>
#import "Firebase.h"
및 didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
에서 내 AppDelegate에에 다음을 추가 한 나는 또한
#import <GoogleMobileAds/GoogleMobileAds.h>
#import <GoogleMobileAds/GADBannerView.h>
#import <GoogleMobileAds/GADBannerViewDelegate.h>
#import "Firebase.h"
추가를 추가했습니다
@interface BT_viewController : UIViewController <GADBannerViewDelegate,
및
@property (nonatomic, weak) IBOutlet GADBannerView *bannerView;
내보기 controller.m 필자의 다음
@protocol GADBannerViewDelegate <NSObject>
@optional
- (void)adViewDidReceiveAd:(GADBannerView *)bannerView;
- (void)adView:(GADBannerView *)bannerView
didFailToReceiveAdWithError:(GADRequestError *)error;
- (void)adViewWillPresentScreen:(GADBannerView *)bannerView;
- (void)adViewDidDismissScreen:(GADBannerView *)bannerView;
- (void)adViewWillDismissScreen:(GADBannerView *)bannerView;
- (void)adViewWillLeaveApplication:(GADBannerView *)bannerView;
@end
는
- (void)adViewDidReceiveAd:(GADBannerView *)bannerView {
bannerView.hidden = NO;
[BT_debugger showIt:self theMessage:@"Google ad shown"];
}
- (void)adView:(GADBannerView *)bannerView didFailToReceiveAdWithError: (GADRequestError *)error {
NSLog(@"adView:didFailToReceiveAdWithError: %@", error.localizedDescription);
}
다음 -(void)viewDidLoad
에서 내가 추가 한 추가
self.bannerView = [[GADBannerView alloc]
initWithFrame:CGRectMake(0.0,
self.view.frame.size.height -
GAD_SIZE_320x50.height,
GAD_SIZE_320x50.width,
GAD_SIZE_320x50.height)];
self.bannerView.delegate = self;
self.bannerView.adUnitID = @"ca-app-pub-3940256099942544/2934735716";
self.bannerView.rootViewController = self;
[self.view addSubview:self.bannerView];
[self.bannerView loadRequest:[GADRequest request]];
확실히 다 알아서 할 수 있지만 절대적으로 아무것도 작동하지 않습니다. 오류가없고 degub, zip ...
도와주세요!
Google Ad Mob 기능을 Cocoa Pods로 설치하는 대신 직접 구현 했습니까? – Mochi
수동으로 수행 한 경우 모든 라이브러리에서 추가 한 내용을 코카 포드 파일에 공유하십시오. 또한 로그를 공유하십시오. 일반적으로 로그에 메시지 –
이 구현되었으며 다음 프레임 워크를 추가했습니다. –