升级到 iPhone 3.0 sdk,现在模拟器显示黑屏
我有一个使用 UITabBarController 的 iPhone 应用程序,其中包含两个 UINavigationController,每个 UINavigationController 又包含一个或多个 TableViewController(实际上是实现 UITableViewDelegate 和 UITableViewDataSource 的自定义 UIViewController。)在启动时,它会显示 UITabBarController 并显示其中一个表视图。 一切都被编码了; Interface Builder 不用于制作任何 UI 内容。 它是用 SDK 2 编写的。它在 sdk 2 中运行良好。
我最近更新到 SDK 3.0。 在 Info 中,我将 Base SDK 设置为 iPhone Simulator 3.0。 现在,当我在模拟器中启动应用程序时,我只看到一个空白的白色屏幕,状态栏位于顶部。 没有我的应用程序的迹象。 但是,当我退出应用程序时,缺少的表格视图会在播放退出动画时短暂显示。 此外,在空白屏幕上,我仍然可以单击导航按钮应该在的位置,并发现当我退出应用程序并且短暂显示丢失的屏幕时,该导航已将我带到另一个屏幕。 所以按钮可以工作,并且大概 tableviewcell 就在那里,只是看不到它们。
有人见过这样的东西吗? 有谁知道是什么原因造成的以及我该如何解决它? 我注意到示例应用程序(例如 SQLiteBooks)在更新到 SDK 3.0 时似乎运行良好。 我的应用程序在使用的技术方面与 SQLiteBooks 没有太大区别,除了我上面所说的,我不使用 Interface Builder。
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. Everything is coded; Interface Builder was NOT used to make any of the UI stuff. It was written in SDK 2. It worked fine in sdk 2.
I recently updated to SDK 3.0. In Info, I set the Base SDK setting to 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. 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.
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. 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
在 IB 中,单击“窗口”并确保选中“启动时可见”。 我的不是,我的应用程序在选中该框后终于出现了。
In IB, click "Window" and make sure "Visible At Launch" is checked. Mine wasn't and my app finally appeared after checking that box.
是的,我终于找到了简单的修复方法 - 在 MainWindow.xib 中打开窗口,将 Alpha 值更改为 0(默认为 100)。
Yes, I finally found the simple fix - open Window in MainWindow.xib, change the Alpha value to 0 (default is 100).
如果您纯粹用代码构建窗口,请务必从目标的属性中删除 MainWindow.xib。
如果这不是问题,我之前也遇到过类似的问题,应用程序在启动时表现异常。 我不确定根本原因是什么,所以这对我来说是反复试验:
1)尝试删除构建目录并重建。
2) 将基础 SDK 设置为 iPhone 设备 3.0。 (无论如何,当您为模拟器构建时,基本 SDK 都会被覆盖)
3) 我也遇到过一个问题,项目 plist 文件和 MainWindow.xib 被意外地从我的项目中删除,并导致了同样的问题。 如果您使用 MainWindow.xib,请仔细检查以确保它们位于您的项目结构中。
If you're building your window purely in code, be sure to remove the MainWindow.xib from the properties in your target.
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.
2) Set the base SDK to iPhone Device 3.0. (The base SDK is overwritten when you build for the simulator anyway)
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. Double check to make sure they are in your project structure if you are using MainWindow.xib.
我不必更改任何 alpha 值设置。 我所做的就是在尝试在 iPhone 模拟器中启动我的项目之前退出 Interface Builder。 由于某种原因,如果 IB 在您第一次运行模拟器时打开,它会给您一个空白屏幕,因此在第一次运行项目之前退出 IB。
I didn't have to change any alpha value settings. All I did was quit Interface Builder before trying to launch my project in the iPhone Simulator. 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.
将 iOS 升级到 4.2 后,我在 iphone 模拟器上遇到了同样的问题,
在尝试了该线程中的人员给出的所有上述解决方案并且没有任何效果后,
我尝试修改该方法中的以下代码
....通过编写这段代码...
I had the same problem of getting white screen on iphone simulator after upgrading my iOS to 4.2
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
method.... by writing this code...
我也有这个问题,我可以通过执行以下操作解决:
在界面生成器中:
在 XCode 中:
- 如果您使用的是 3.0 或更高版本,请在应用程序委托中注释此代码行:
// window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen]bounds]]
I also have this issue, I coud solved doing the following:
In Interface builder:
In XCode:
- If you are using 3.0 or upper, comment this code line in your application delegate:
// window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]
看来您必须在运行之前保存新界面。 我以前从未为 iPhone 开发过,终于弄清楚为什么我会出现白屏。 似乎它应该在运行前自动保存,但显然没有。
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. Seems like it should save automatically before running but apparently it doesn't.
我通过将模式从“缩放到填充”更改为“中心”来修复我的问题。 在我更改 Alpha 之前,它所做的只是将背景更改为黑色。 我认为实际值可能没有正确缩放,我是对的。 再次,只需将模式从“缩放到填充”更改为“中心”,瞧,它应该可以工作。
I fixed mine by changing the mode from
Scale To Fill
toCenter
. Before I changed the alpha and all it did was change the background to black. I figured perhaps the actual values were not scaling correctly, and I was correct. Again, simply change the mode fromScale To Fill
toCenter
and voilà, it should work.