2014-11-03 73 views
1

我想指出的是,自我是一個WelcomeViewController,它從UIViewController的繼承:「self.canDisplayBannerAds = YES;」使應用程序在iOS 8上崩潰?

WelcomeViewController.h

#import <UIKit/UIKit.h> 

@interface WelcomeViewController : UIViewController 
@property (strong, nonatomic) NSString* score; 
@property (strong, nonatomic) NSUserDefaults* preferences; 


@end 

WelcomeViewController.m

#import "WelcomeViewController.h" 
#import "GESceneController.h" 
#import <iAd/iAd.h> 
@interface WelcomeViewController() 
@property (weak, nonatomic) IBOutlet UILabel *scoreLabel; 
@property (weak, nonatomic) IBOutlet UILabel *highScoreLabel; 

@end 

@implementation WelcomeViewController 

- (void)viewDidLoad { 
    [super viewDidLoad]; 
    self.canDisplayBannerAds = YES; 
    [self.scoreLabel setText:self.score]; 

    NSString* highScoreText = [NSString stringWithFormat:@"Meilleur score : %ld", 
           [self.preferences integerForKey:@"highscore"]]; 

    [self.highScoreLabel setText:highScoreText]; 

    // Do any additional setup after loading the view. 
} 

和我獲取錯誤:[WelcomeViewController setCanDisplayBannerAds:]:無法識別的選擇器發送到實例0x7d97 f080

+1

你問如何解決這個問題?或者指出一個錯誤?或者是什麼?閱讀SO常見問題原因我不認爲這個問題在當前時間跟隨它。 – 2014-11-03 19:00:00

+0

你是對的,我編輯了主題並添加了一個問號。謝謝。 – acanterot 2014-11-04 12:20:16

回答

7

您是否已將iAd文件導入鏈接的框架和庫?如果沒有,轉到你的編譯信息並一直滾動到底部,在那裏你會找到'鏈接框架',並將該框架添加到你的應用程序中。

+0

我覺得很蠢。大聲笑。忘記我正在測試admob,而不是真的iAd,所以沒有聯繫它。哈哈哈 – 2015-11-12 13:25:31