Thursday, 12 September 2013

Created a new empty project in XCode and added a View Controller but it wont compile

Created a new empty project in XCode and added a View Controller but it
wont compile

Just like the title says, I created a new empty project in xcode that just
gave me the AppDelegate header and compile files. I then added a view
controller to it and then changed the Main Interface to the name of the
viewcontroller xib file. I went ahead and ran the project without adding
anything else. I've done this before and it has ran, but this time it is
not.
The error message is
'NSUnknownKeyException', reason: 'setValue:forUndefinedKey:]: this class
is not key value coding-compliant for the key view.'
I have didn't write any code or changed anything other than what I
explained above. The only code in the AppDelegate is the following:
.h
#import <UIKit/UIKit.h>
#import "PopOverViewController.h"
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
.m
#import "AppDelegate.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen]
bounds]];
// Override point for customization after application launch.
[self.window makeKeyAndVisible];
return YES;
}
@end
ViewController.h
#import <UIKit/UIKit.h>
@interface PopOverViewController : UIViewController
@end
ViewController.m
#import "PopOverViewController.h"
@interface PopOverViewController ()
@end
@implementation PopOverViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle
*)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
I've searched through this site but couldn't find anything similar. Every
post is about checking the IBOutlets and IBActions and connections but I
havent done anything. All I did was like the View to the FileOwner, that's
it.

No comments:

Post a Comment