应用程序有时会显示白屏 - iOS4

发布于 2024-10-15 05:44:24 字数 991 浏览 4 评论 0原文

我的应用程序在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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

£冰雨忧蓝° 2024-10-22 05:44:24

您仅在一种情况下将子视图添加为窗口的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文