iphone app not working ipad simulator

心已入冬 提交于 2019-12-12 17:43:33

问题


My iphone app runs on iphone simulator and devices but not on ipad simulator. It doesnt showing any errors but the application is not launching just blank black screen only displays.

While running in ipad simulator 5 it showing following error "applications are expected to have a root view controller at the end of application launch"

My application didFinishLaunchingWithOptions code is as below :

rootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
[self.rootViewController.view setFrame:CGRectMake(0, 20, 320, 460)];
[self.window addSubview:self.rootViewController.view];

[self.window makeKeyAndVisible];
return YES;

And my main.m code is as below :

 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;

What is the wrong with this???


回答1:


Go on the App Target info and set "Target device Family":"iPhone" then it works fine both on iphone and ipad simulator and device both.




回答2:


What if you change this:

rootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];

to this:

self.rootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];



回答3:


Check....Navigation Controller delegate must have been connected (delegate > AppDelegate) in IB.



来源:https://stackoverflow.com/questions/8060422/iphone-app-not-working-ipad-simulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!