如何在加载时更改白屏?

时间:2017-09-28 00:51:55

标签: ios swift xcode appdelegate

在我的第一堂课开始之前,我在AppDelegate课程的应用程序中有白屏。 我看到这个白色的屏幕4-5秒。

如何解决这个白色问题?

这是我的AppDeledate类

class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

    FirebaseApp.configure()

    window = UIWindow(frame: UIScreen.main.bounds)

    window?.makeKeyAndVisible()

    window?.rootViewController = UINavigationController(rootViewController: ScreensaverViewController())

    //получение смс для регистрации
     if #available(iOS 10, *){
        UNUserNotificationCenter.current().requestAuthorization(options: [.badge, .sound, .alert], completionHandler: { (granted, error) in })
            application.registerForRemoteNotifications()

    } else {
            let notificationSettings = UIUserNotificationSettings(types: [.badge, .alert, .sound], categories: nil)
        UIApplication.shared.registerUserNotificationSettings(notificationSettings)
        UIApplication.shared.registerForRemoteNotifications()
    }

    //получение уведомлений с сервера
    let notificationTypes : UIUserNotificationType = [UIUserNotificationType.alert, UIUserNotificationType.badge, UIUserNotificationType.sound]
    let notificationSettings = UIUserNotificationSettings(types: notificationTypes, categories: nil)
    application.registerForRemoteNotifications()
    application.registerUserNotificationSettings(notificationSettings)

    return true
}

0 个答案:

没有答案