2013-08-28 1 views
1

를 선언하지,이 컴파일러 오류가 점점 계속 :아이폰 OS는 오류를 컴파일 : 나는 ARC 내 아이폰 OS 프로젝트를 전환 이후 'CDViewController'에 대한 눈에 띄는 @ 인터페이스가 선택

[self.viewController setUseAgof:false]; 
:이 라인에서

No visible @interface for 'CDViewController' declares the selector 'setUseAgof:'

을 이 파일에서

:

AppDelegate.m

메소드가 확실히 정의되어 있지만3210
#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

viewControllerCDVViewController의 포인터로 선언 된 것 같습니다. CDVViewController에서 파생 된 클래스 MainViewController의 일부인 메서드를 호출하고 있습니다. 메서드 호출은 기본 클래스가 아닌 파생 클래스의 일부이므로 viewController 포인터를 MainViewController 포인터로 변경하십시오.

0

AppDelegateviewController 속성을 확인 CDVViewController *보다는 UIViewController *의 유형이 있습니다.

+0

나에게 잘 보일 것 :'@property (nonatomic, strong) IBOutlet CDVViewController * viewController;' – Timo

+1

'MainViewController'가되어야합니까? OP가'MainViewController' 인터페이스에서 함수를 선언했기 때문에. – Amar

+0

@Timo 선언 된 메서드는 기본 클래스가 아닌 파생 클래스의 일부입니다. 문제가 있습니까? – Amar