Monday, 15 March 2010

iphone - Application running with RootviewController error- Applications are expected to have a root view controller at the end of application launch -



iphone - Application running with RootviewController error- Applications are expected to have a root view controller at the end of application launch -

- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; // override point customization after application launch. self.viewcontroller = [[viewcontroller alloc] initwithnibname:@"viewcontroller" bundle:nil]; self.window.rootviewcontroller = self.viewcontroller; [self.window makekeyandvisible]; homecoming yes; }

i not know wrong method.i created new project , run it.it showing applications expected have root view controller @ end of application launch

if have mainwindow.xib.

remove below line. not remove mainwindow.xib

self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { self.viewcontroller = [[viewcontroller alloc] initwithnibname:@"viewcontroller" bundle:nil]; self.window.rootviewcontroller = self.viewcontroller; [self.window makekeyandvisible]; homecoming yes; }

or

do not remove above line. remove mainwindow.xib , project summary main interface set null.

- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; self.viewcontroller = [[viewcontroller alloc] initwithnibname:@"viewcontroller" bundle:nil]; self.window.rootviewcontroller = self.viewcontroller; [self.window makekeyandvisible]; homecoming yes; }

iphone xcode

No comments:

Post a Comment