2016-12-28 3 views
0

私は複数のチュートリアルを試して、複数の場所でコードを試しましたが、何かをするためにGoogleのadmobを得ることができません。シミュレータでエラーが発生せず、プロジェクトがビルドされ、実行されます。デバッガに広告が読み込まれず、メッセージも表示されません。 基本的に何も起こっていません。私も追加はios8アプリで働くためにadmobを得ることができません

#import <GoogleMobileAds/GoogleMobileAds.h> 
#import <GoogleMobileAds/GADBannerView.h> 
#import <GoogleMobileAds/GADBannerViewDelegate.h> 
#import "Firebase.h" 

を追加しました私は私のappDelegate

#import <GoogleMobileAds/GoogleMobileAds.h> 
#import <GoogleMobileAds/GADBannerView.h> 
#import <GoogleMobileAds/GADBannerViewDelegate.h> 
#import "Firebase.h" 

didFinishLaunchingWithOptions:(NSDictionary *)launchOptionsの下で、私は私のviewcontroller.h

[FIRApp configure]; 
[GADMobileAds configureWithApplicationID:@"ca-app-pub-5601547953982889~9365662253"]; 

を入れている中で、以下を追加しました

@interface BT_viewController : UIViewController <GADBannerViewDelegate, 

@property (nonatomic, weak) IBOutlet GADBannerView *bannerView; 

@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 

その後、私の見解をcontroller.mアイブで私は

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]]; 
01を追加しました -(void)viewDidLoadの下で、その後

- (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); 
} 

を追加し、

私はそれをすべてカバーしましたが、絶対に何も働いていません。エラーはありません。脱泡しません。

助けてください!

+0

Google Ad Mobの機能は、Cocoa Podsでインストールするのではなく、自分で実装しましたか? – Mochi

+0

手動で行った場合は、すべてのライブラリを追加して、コカのポッドファイルを共有してください。また、ログを共有します。通常ログにはメッセージ –

+0

が実装され、次のフレームワークが追加されました。 –

答えて

0

私はCocoa Podsをインストールしようと決めましたが、それでも同じ結果が出ました。次に、GADbannerviewファイルに広告を読み込むサンプルコードがあることがわかりました。私はこのコードを試して、今広告が表示されます!

GADBannerView *adView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner]; 
adView.rootViewController = self; 
adView.adUnitID = @"ca-app-pub-3940256099942544/2934735716"; 
/// // Place the ad view onto the screen. 
[self.view addSubview:adView]; 
/// // Request an ad without any additional targeting information. 
[adView loadRequest:[GADRequest request]]; 
関連する問題