1

I have tried for 2 days now to get my storyboard to display with this code:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
   UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
    UIViewController *LoginViewController = [storyboard instantiateInitialViewController];

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

    return YES;
}

However, I keep getting this error and a sigbart in my main: 'NSInvalidArgumentException', reason: 'Could not find a storyboard named 'MainStoryboard' in bundle NSBundle (loaded)'

Nothing seems to appear in google about these errors? Does anyone have any idea how to fix it?

Update: When I change it to:

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

    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
    UIViewController *LoginViewController = [storyboard instantiateInitialViewController];

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

    return YES;
}

it gives me the errors: [3208:c07] The app delegate must implement the window property if it wants to use a main storyboard file.

{AppDelegate setWindow:]: unrecognized selector sent to instance 0x962bf30

[3208:c07] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AppDelegate setWindow:]: unrecognized selector sent to instance 0x962bf30'

1 Answers1

3

Finally Found It!!!!!! Turns out that I forgot to put this line of code in the app delegate header file:

@property (strong, nonatomic) UIWindow *window;