gpt4 book ai didi

swift - 带有 Firebase 的 iOS 应用程序不会以缓慢的互联网连接启动

转载 作者:搜寻专家 更新时间:2023-11-01 07:22:51 24 4
gpt4 key购买 nike

自从我升级到新的 Firebase 后,我的应用程序不再以缓慢的互联网连接启动。它在连接良好以及根本没有任何连接时执行。我认为我已经正确设置了所有内容,因为如果我在设置时出错,它根本无法工作。

这是我的 AppDelegate 代码:

import UIKit
import Firebase

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(application: UIApplication, didFinishLaunchingWithOptionslaunchOptions: [NSObject: AnyObject]?) -> Bool {

UITabBar.appearance().tintColor = UIColor.redColor()

FIRApp.configure()
FIRDatabase.database().persistenceEnabled = true

return true
}

}

最佳答案

iOS 包含一种称为看门狗的机制,它将终止在特定时间窗口内未能启动的任何应用程序。您在 application(_:didFinishLaunchingWithOptions:) 中执行的任何阻塞任务如果花费的时间过长,都有可能导致您的应用终止。您应该考虑异步执行此类任务。

您可以在代码中放置断点或打印语句以确定哪一行花费的时间太长。

关于swift - 带有 Firebase 的 iOS 应用程序不会以缓慢的互联网连接启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37713838/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com