我想指出self是一个WelcomeViewController,它继承自UIViewController:
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:]:无法识别的选择器发送到实例0x7d97f080
答案 0 :(得分:7)
您是否已将iAd文件导入链接的框架和库?如果没有,转到您的构建信息并一直滚动到底部,在那里您将找到“链接的框架......”并将框架添加到您的应用程序中。