应用程序有时会显示白屏 - iOS4
我的应用程序在iOS4上运行良好,除了有时它会显示白屏,特别是在很长一段时间不使用该应用程序之后(我猜它可能会从后台删除,但我已经尝试过),但是,如果我关闭应用程序并再次重新打开它,一切正常。不知道这个有没有什么具体的问题。这是一个带有标签的普通 iPhone 应用程序。
这是application:didFinishLaunchingWithOptions:
,
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
gpsUpdate=0;
NSLog(@"entro a didFinishLaunch");
if (locationManager == nil ) {
}
if ([launchOptions objectForKey: UIApplicationLaunchOptionsLocationKey] != nil) {
// register for local notification
}
else {
iconBadNumber=0;
[self checkConnection];
[self copyDatabaseIfNeeded];
iconBadNumber=0;
self.alertsArray = [[NSMutableArray alloc] init];
self.searchArray = [[NSMutableArray alloc] init];
[Alertas getAllAlerts];
[window addSubview:tabBarController.view];
}
[tabBarController setDelegate:self];
return YES;
}
My app runs well on iOS4, except that sometimes it shows a whitescreen, especially after a long period of time not using the app (I guess that it may get deleted from the background, but I already tried), but then, if I close the app and reopen it again, everything works just fine. I don't know if there is any specific problem with this. It is a normal iphone app with tabs.
Here is the application:didFinishLaunchingWithOptions:
,
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
gpsUpdate=0;
NSLog(@"entro a didFinishLaunch");
if (locationManager == nil ) {
}
if ([launchOptions objectForKey: UIApplicationLaunchOptionsLocationKey] != nil) {
// register for local notification
}
else {
iconBadNumber=0;
[self checkConnection];
[self copyDatabaseIfNeeded];
iconBadNumber=0;
self.alertsArray = [[NSMutableArray alloc] init];
self.searchArray = [[NSMutableArray alloc] init];
[Alertas getAllAlerts];
[window addSubview:tabBarController.view];
}
[tabBarController setDelegate:self];
return YES;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您仅在一种情况下将子视图添加为窗口的 tabBarController.view 。在 didFinishLaunchingWithOptions 方法中,您始终需要添加一些视图作为窗口的子视图,否则它将显示白屏,因为它是窗口的默认颜色。
you are adding subview as tabBarController.view for window in only one condition. Always inside the didFinishLaunchingWithOptions method you need to add some view as a subview to window otherwise it will show white screen as it is the default color of the window.