Reputation: 15973
Since I switched my iOS project to ARC, I keep getting this compiler error:
No visible @interface for 'CDViewController' declares the selector 'setUseAgof:'
In this line:
[self.viewController setUseAgof:false];
In this file:
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
Although the method is definitely defined:
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;
}
I don't get it. What's wrong?
Update:
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
Upvotes: 1
Views: 7304
Reputation: 13222
viewController
seems to be declared as pointer of CDVViewController
. You are calling a method which is part of MainViewController
the class derived from CDVViewController
. Method being called is part of derived class and not the base class, hence make viewController
pointer of MainViewController
instead.
Upvotes: 0
Reputation: 24447
Make sure the viewController
property in your AppDelegate
has a type of CDVViewController *
rather than UIViewController *
.
Upvotes: 0