2013-08-28 15 views
1

,我不断收到此编译器错误: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 

回答

0

viewController似乎宣布为CDVViewController的指针。您正在调用MainViewController类别CDVViewController派生类的一部分。被调用的方法是派生类的一部分而不是基类,因此取而代之的是使指针viewControllerMainViewController

0

确保viewController财产在你AppDelegate的类型为CDVViewController *,而不是UIViewController *

+0

对我来说很好看:'@property(nonatomic,strong)IBOutlet CDVViewController * viewController;' – Timo

+1

它应该是'MainViewController'吗?由于OP在'MainViewController'接口中声明了该函数。 – Amar

+0

@Timo声明的方法是派生类的一部分,而不是基类。你有问题吗? – Amar

相关问题