我正在尝试将Ad的介绍放入我的xcode项目,但每次运行该项目时它都会停止,并且我会在显示
的行上收到“Thread 1 SIGABRT错误”bannerView_ = [[GADBannerView alloc] initWithFrame:CGRectMake(0, 20, 320, 50)];
此部分的完整代码是 -
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
bannerView_ = [[GADBannerView alloc] initWithFrame:CGRectMake(0, 20, 320, 50)];
bannerView_.adUnitID = @"ca-app-pub-1249154779941831/7243806389";
bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];
[bannerView_ loadRequest:[GADRequest request]];
SoundButton = [UIButton buttonWithType:UIButtonTypeCustom];
代码是GADBannerview.h
//
// GADBannerView.h
// Google Mobile Ads SDK
//
// Copyright 2011 Google Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "GADAdSize.h"
#import "GADBannerViewDelegate.h"
#import "GADInAppPurchaseDelegate.h"
#import "GADModules.h"
#import "GADRequest.h"
#import "GADRequestError.h"
@interface GADBannerView : UIView
#pragma mark Initialization
- (instancetype)initWithAdSize:(GADAdSize)adSize origin:(CGPoint)origin;
- (instancetype)initWithAdSize:(GADAdSize)adSize;
#pragma mark Pre-Request
@property(nonatomic, copy) NSString *adUnitID;
@property(nonatomic, weak) UIViewController *rootViewController;
@property(nonatomic, assign) GADAdSize adSize;
@property(nonatomic, weak) id<GADBannerViewDelegate> delegate;
@property(nonatomic, weak) id<GADInAppPurchaseDelegate> inAppPurchaseDelegate;
#pragma mark Making an Ad Request
- (void)loadRequest:(GADRequest *)request;
#pragma mark Ad Request
@property(nonatomic, readonly, assign) BOOL hasAutoRefreshed;
#pragma mark Mediation
@property(nonatomic, readonly, weak) NSString *adNetworkClassName;
@property(nonatomic, readonly, weak) UIView *mediatedAdView
__attribute__((deprecated("Use adNetworkClassName.")));
@end
答案 0 :(得分:1)
请尝试使用-ObjC -alll_load
设置“其他链接标记”,它应该有效。