启动应用程序前几分钟出现白屏 - Xcode 13 on iOS 15.1.1

White Screen Shows for Minutes Before Launching App - Xcode 13 on iOS 15.1.1

这是我在使用 Xcode 13 和 iOS 15.1.1 时遇到的一个奇怪的错误。我开发了一个简单的应用程序,当我 运行 iOS 15.1.1(iPhone 13 Pro)上的应用程序时,在应用程序启动白屏之前(如果是暗模式则为黑色) ON),会显示几分钟。

有人知道解决这个问题的方法吗?这完全扰乱了开发过程,并在测试应用程序时打断了流程。构建时间在一分钟内,您必须等待额外的时间才能让白屏消失。

我尝试了以下解决方案,但没有用

  1. 删除 iOS DeviceSupport 并重新启动 Xcode

rm -r ~/Library/Developer/Xcode/iOS\ DeviceSupport


编辑 1:这仅在按下 Xcode 中的 运行 按钮时发生,并且在它从 Xcode 启动后我关闭应用程序并从 phone 重新开始工作正常

删除 DerivedData 也不起作用

部分代码供参考:

AppDelegate.swift

import UIKit
import Firebase

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    // MARK: - didFinishLaunchingWithOptions
    
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
                   
        let storyboard =  UIStoryboard(name: "Main", bundle: nil)
        self.window?.rootViewController = storyboard.instantiateInitialViewController()
        self.window?.makeKeyAndVisible()
        
        
        FirebaseApp.configure()
        
        return true
    }

    // MARK: -
    
    // MARK: UISceneSession Lifecycle

    func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
        // Called when a new scene session is being created.
        // Use this method to select a configuration to create the new scene with.
        return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
    }

    // MARK: - didDiscardSceneSessions
    
    func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
        // Called when the user discards a scene session.
        // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
        // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
    }

    

}

根目录 VC:

import UIKit

class VC_AppleSignIn: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        print("Hello World!")
    }

}

如果需要任何其他代码,请告诉我!

问题终于解决了。我将 Xcode 更新为 13.2 并修复了它。不确定是什么原因造成的。但它已通过新 Xcode 更新

修复