Sepehrom
Sepehrom

Reputation: 1335

Specify App Delegate for Storyboard in iOS

I'm trying to change my App's main interface which currently is set to a .xib file in the project's "General Configuration Pane" to a new storyboard.

I have created the storyboard, and selected it as the main interface. But when I launch the application in simulator, I get a black screen and the following message printed in the console : "There is no app delegate set. An app delegate class must be specified to use a main storyboard file."

How should I do that ?

Upvotes: 5

Views: 6407

Answers (3)

Dave Batton
Dave Batton

Reputation: 8835

The app delegate class is generally specified in main.m:

int main(int argc, char *argv[])
{
  @autoreleasepool {
      return UIApplicationMain(argc, argv, nil, NSStringFromClass([TCAppDelegate class]));
  }
}

Upvotes: 5

Saurav Mac
Saurav Mac

Reputation: 82

In didFinishLaunchingWithOptions method put these code lines .

UIStoryboard *storyBoard; = [UIStoryboard storyboardWithName:@"yourStoryboardName" bundle:nil];
 UIViewController *initViewController = [storyBoard instantiateInitialViewController];
      [self.window setRootViewController:initViewController];

return Yes ;

Upvotes: 0

codercat
codercat

Reputation: 23271

did you set mainWindow if you are not please set your window in your project

Upvotes: 1

Related Questions