Xcode 4 issue with AppDelegate.m adding view controller - xcode 4.2 storyboard
-
23-03-2021 - |
سؤال
I'm having a problem. I'm following this tutorial
The part I'm having is in my AppDelegate.m
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Register for alert notifications
[application registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert];
// Add the view controller's view to the window and display.
[_window addSubview:viewController.view];
[_window makeKeyAndVisible];
// Override point for customization after application launch.
return YES;
}
My issue is that I'm using a storyboard as my main view. I have no xibs. The error I'm receiving is " Use of undeclared identifier viewContoller
. I'm guessing it has something to do with storyboard. Can someone please let me know how to make it work with storyboard. Thanks.
المحلول
You can omit these two lines:
[_window addSubview:viewController.view];
[_window makeKeyAndVisible];
In the storyboard whichever view controller you mark as the "Initial View Controller" will be the rootViewController of the window.
If you are using a storyboard (and/or ARC), you may want to look for a tutorial that uses those features.
لا تنتمي إلى StackOverflow