1. iOS版本确认
- (void)viewDidLoad {
[super viewDidLoad];
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 4.0) {
bannerView = [[ADBannerView alloc] init];
bannerView.delegate = self;
[self.view addSubview:bannerView];
}
2. 新类是否存在
Class clazz = NSClassFromString(@"ADBannerView");
if (clazz) {
bannerView = [[ADBannerView alloc] init];
bannerView.delegate = self;
[self.view addSubview:bannerView];
}
3. 新接口是否存在
if (UIGraphicsBeginImageContextWithOptions != NULL) {
bannerView = [[ADBannerView alloc] init];
bannerView.delegate = self;
[self.view addSubview:bannerView];
}