Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS编译错误:';没有可见的@interface;CDViewController';声明选择器_Ios_Xcode - Fatal编程技术网

iOS编译错误:';没有可见的@interface;CDViewController';声明选择器

iOS编译错误:';没有可见的@interface;CDViewController';声明选择器,ios,xcode,Ios,Xcode,自从我将iOS项目切换到ARC后,我一直遇到以下编译器错误: “CDViewController”没有可见的@interface声明选择器 “setUseAgof:” 在这方面: [self.viewController setUseAgof:false]; 在此文件中: AppDelegate.m #import "AppDelegate.h" #import "MainViewController.h" #import <Cordova/CDVPlugin.h> #import

自从我将iOS项目切换到ARC后,我一直遇到以下编译器错误:

“CDViewController”没有可见的@interface声明选择器 “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
#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 <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
#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
#导入
#进口
#进口
@接口AppDelegate:NSObject{}
@属性(非原子,强)IBUIWindow*window;
@属性(非原子、强)IBOutlet CDVViewController*viewController;
@结束

确保
AppDelegate
中的
viewController
属性的类型为
CDVViewController*
,而不是
UIViewController*

viewController
的指针。您正在调用的方法是
MainViewController
派生自
CDVViewController
的类的一部分。被调用的方法是派生类的一部分,而不是基类,因此将
viewController
指针改为
MainViewController

看起来不错:
@property(非原子,强)IBOutlet CDVViewController*viewController是否应该是
MainViewController
?因为OP在
MainViewController
接口中声明了函数。@Timo声明的方法是派生类的一部分,而不是基类。你明白问题吗?@Amar该死,你说得对!因此,在AppDelegate.h中,它必须是
@property(非原子,强)IBOutlet MainViewController*viewController-谢谢!如果你把你的建议作为答案发表,我会很高兴地把它标记为“正确答案”。