,我不断收到此编译器错误:iOS的编译错误:因为我交换我的iOS项目ARC为 'CDViewController' 不可见@interface声明选择
No visible @interface for 'CDViewController' declares the selector 'setUseAgof:'
在这一行:
[self.viewController setUseAgof:false];
在这个文件中:
AppDelegate.m
#import "AppDelegate.h"
#import "MainViewController.h"
#import <Cordova/CDVPlugin.h>
#import "NSString+MD5.h"
@implementation AppDelegate
@synthesize window, viewController;
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
// (...)
[self.viewController setUseAgof:false]; // <-- HERE
// (...)
return YES;
}
@end
尽管该方法是绝对定义:
MainViewController.h
#import <Cordova/CDVViewController.h>
#import <ADTECHMobileSDK/ADTECHMobileSDK.h>
@interface MainViewController : CDVViewController <ATInterstitialViewDelegate>{
ATInterstitialView *interstitial;
}
- (void)setUseAgof:(BOOL)useAgofParam;
@end
@interface MainCommandDelegate : CDVCommandDelegateImpl
@end
@interface MainCommandQueue : CDVCommandQueue
@end
MainViewController.m
#import "MainViewController.h"
@interface MainViewController()
- (void)setUseAgof:(BOOL)useAgofParam;
@end
@implementation MainViewController
BOOL useAgof = true;
- (void)setUseAgof:(BOOL)useAgofParam
{
NSLog(@"1.) Setting useAgof = %d", (int)useAgofParam);
useAgof = useAgofParam;
}
我不明白这一点。怎么了?
更新:
AppDelegate.h
#import <UIKit/UIKit.h>
#import <Cordova/CDVViewController.h>
#import <INFOnlineLibrary/INFOnlineLibrary.h>
@interface AppDelegate : NSObject <UIApplicationDelegate>{}
@property (nonatomic, strong) IBOutlet UIWindow* window;
@property (nonatomic, strong) IBOutlet CDVViewController* viewController;
@end
对我来说很好看:'@property(nonatomic,strong)IBOutlet CDVViewController * viewController;' – Timo
它应该是'MainViewController'吗?由于OP在'MainViewController'接口中声明了该函数。 – Amar
@Timo声明的方法是派生类的一部分,而不是基类。你有问题吗? – Amar