create iOS app without a storyboard

I am attempting to create an app that does not utilize a storyboard. It consists of a View Controller and the corresponding XIB file.

Per what I have read


I have made the XIB the main launch point .

I have revised the App Delegate as follows:


#import "BondValueViewController.h"


@interface AppDelegate

BondValueViewController *bv;

...


@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

self.bv = [[BondValueViewController alloc] initWithNibName:@"BondValueViewController" bundle:nil];

self.window.rootViewController = self.bv;

[self.window makeKeyAndVisible];

return YES;

}


I get the following result.


Terminating ... this class is not key value coding complient of the key. ...


Thanks in advance.


Mark Schapira

Replies

Some additional information:


I placed breakpoints in the AppDelegate.m file.


I did not stop the app at eny breakpoint before crashing.


Apparently, the AppDelegate is not visited.


Mark Schapira

May need tweaking, but try something like this:


#import "BondValueViewController.h"

@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // create an instance of the view controller you want to be displayed first
   BondValueViewController *bondValueViewController = [[BondValueViewController alloc] initWithNibName:@"BondValueViewController" bundle:nil];
    // set it as the root view controller of the application's window
    [self.window setRootViewController:bondValueViewController];
    [self.window makeKeyAndVisible];
    return YES;
}

Did the error tell you the name of the key that it was missing?


Usually this happens when there's an outlet in the .xib (or storyboard) that has been connected to a variable in an object and then the variable has been renamed or deleted without the connection being removed.