简体   繁体   English

升级到iPhone 3.0 sdk,现在模拟器显示空白屏幕

[英]Upgrade to iPhone 3.0 sdk and now simulator shows blank screen

I have an iPhone app that uses an UITabBarController, which contains two UINavigationControllers, each of which in turn contains one or more TableViewControllers (actually, customized UIViewControllers implementing UITableViewDelegate and UITableViewDataSource. ) On launch, it displays the UITabBarController with one of the tableviews displayed. 我有一个使用UITabBarController的iPhone应用程序,它包含两个UINavigationControllers,每个UINavigationControllers又包含一个或多个TableViewControllers(实际上是实现UITableViewDelegate和UITableViewDataSource的自定义UIViewControllers。)启动时,它会显示UITabBarController,其中一个是显示的表视图。 Everything is coded; 一切都是编码的; Interface Builder was NOT used to make any of the UI stuff. Interface Builder不用于制作任何UI内容。 It was written in SDK 2. It worked fine in sdk 2. 它是用SDK 2编写的。它在sdk 2中运行良好。

I recently updated to SDK 3.0. 我最近更新到SDK 3.0。 In Info, I set the Base SDK setting to iPhone Simulator 3.0. 在Info中,我将Base SDK设置设置为iPhone Simulator 3.0。 Now, when I launch the application in Simulator, I see only a blank white screen with the status bar at the top. 现在,当我在模拟器中启动应用程序时,我只看到一个空白的白色屏幕,状态栏位于顶部。 No signs of my app. 没有我的应用程序的迹象。 However, when I exit the app, the missing tableview displays briefly as the exiting animation is playing. 但是,当我退出应用程序时,缺少的tableview会在播放现有动画时短暂显示。 Also, on the blank white screen I can still click where the navigation buttons should be and find that, when I exit the app and the missing screen briefly displays, that navigation has taken me to another screen. 此外,在空白的白色屏幕上,我仍然可以单击导航按钮所在的位置,并发现当我退出应用程序并且短暂显示丢失的屏幕时,导航已将我带到另一个屏幕。 So the buttons work, and presumably the tableviewcells are there, they just cannot be seen. 因此按钮工作,并且可能是tableviewcells在那里,他们只是无法看到。

Has anyone seen anything like this? 有没有人见过这样的东西? Does anyone have any idea what is causing it and how I can fix it? 有谁知道是什么导致它以及我如何解决它? I noticed that sample apps, such as SQLiteBooks, seem to work fine when updating to SDK 3.0. 我注意到更新到SDK 3.0时,示例应用程序(如SQLiteBooks)似乎工作正常。 My app isn't very much different from SQLiteBooks in terms of technologies used, except that, as I said above, I do not use Interface Builder. 我的应用程序与SQLiteBooks在使用的技术方面没有太大的不同,只是如上所述,我不使用Interface Builder。

In IB, click "Window" and make sure "Visible At Launch" is checked. 在IB中,单击“窗口”并确保选中“在启动时可见”。 Mine wasn't and my app finally appeared after checking that box. 我没有,我的应用程序终于出现在检查该框后。

是的,我终于找到了简单的修复 - 在MainWindow.xib中打开Window,将Alpha值更改为0(默认值为100)。

If you're building your window purely in code, be sure to remove the MainWindow.xib from the properties in your target. 如果您只是在代码中构建窗口,请务必从目标中的属性中删除MainWindow.xib。

If that's not the problem, I have had similar issues before with apps behaving strangely on launch. 如果那不是问题,我之前遇到类似的问题,应用程序在启动时表现得很奇怪。 I'm not sure what the root cause, so it's trial and error for me: 我不确定根本原因是什么,所以这对我来说是反复试验的:

1) Try deleting the build directory and rebuilding. 1)尝试删除构建目录并重建。

2) Set the base SDK to iPhone Device 3.0. 2)将基本SDK设置为iPhone Device 3.0。 (The base SDK is overwritten when you build for the simulator anyway) (无论如何,在为模拟器构建时都会覆盖基础SDK)

3) I also had an issue one time where the project plist file and MainWindow.xib got deleted from my project accidentally, and it caused this identical issue. 3)我曾经有一个问题,一次是项目plist文件和MainWindow.xib意外地从我的项目中删除了,这引起了同样的问题。 Double check to make sure they are in your project structure if you are using MainWindow.xib. 如果您使用的是MainWindow.xib,请仔细检查以确保它们位于您的项目结构中。

I didn't have to change any alpha value settings. 我没有必要更改任何alpha值设置。 All I did was quit Interface Builder before trying to launch my project in the iPhone Simulator. 在尝试在iPhone模拟器中启动项目之前,我所做的就是退出Interface Builder。 For some reason if IB is open the first time you run the simulator it will give you a blank screen, so quit out of IB before running the project for the first time. 出于某种原因,如果IB在第一次运行模拟器时打开,它将为您提供一个空白屏幕,因此在第一次运行项目之前退出IB。

I had the same problem of getting white screen on iphone simulator after upgrading my iOS to 4.2 将我的iOS升级到4.2后,我遇到了在iphone模拟器上获取白屏的问题

After trying all the above solutions given by the people in this thread and nothing effecting the problem, 在尝试了此线程中的人员给出的所有上述解决方案后,没有任何影响问题,

I tried modifying the following code in the 我尝试修改下面的代码

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

method.... by writing this code... 方法....通过编写此代码...

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



    // HomeScreen is my first view that should be displayed on the app launch
    // Creating the homescreen instance in the appdelegate method and 
    // assigned it to the homeScreenWindow element declared in the appdelegate class

    HomeScreen *aHomeScreen = [[HomeScreen alloc]initWithNibName:@"HomeScreen" bundle:nil];
    self.homeScreenWindow = aHomeScreen;
    [aHomeScreen release];
    // assigning ends here

    [window addSubview:[homeScreenWindow view]];
    [window makeKeyAndVisible];

    return YES;
}

I also have this issue, I coud solved doing the following: 我也有这个问题,我已经解决了以下问题:

In Interface builder: 在Interface构建器中:

  • File's owner: is your application delegate 文件所有者:是您的应用程序代理
  • window: is the application's delegate window outlet window:是应用程序的委托窗口

In XCode: - If you are using 3.0 or upper, comment this code line in your application delegate: 在XCode中: - 如果您使用的是3.0或更高版本,请在应用程序委托中注释此代码行:

// window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]

I fixed mine by changing the mode from Scale To Fill to Center . 我通过将模式从Scale To Fill更改为Center来修复我的。 Before I changed the alpha and all it did was change the background to black. 在我更改alpha之前,它所做的就是将背景更改为黑色。 I figured perhaps the actual values were not scaling correctly, and I was correct. 我想也许实际值没有正确缩放,我是对的。 Again, simply change the mode from Scale To Fill to Center and voilà, it should work. 再次,只需将模式从Scale To Fill更改为Center并vo,它应该可以工作。

It appears you have to save the new interface before running. 看来你必须在运行之前保存新界面。 I have never developed for IPhone before and finally figured out why i was getting a white screen. 我以前从未为iPhone开发过,最后弄清楚为什么我会看到白屏。 Seems like it should save automatically before running but apparently it doesn't. 似乎它应该在运行之前自动保存,但显然它不会。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM