gpt4 book ai didi

ios - 只需单击启动图标,应用程序就会卡住我的整个手机

转载 作者:行者123 更新时间:2023-11-30 13:09:37 29 4
gpt4 key购买 nike

我是一名新开发人员,目前正在制作我的第一个应用程序。有时,当我尝试打开该应用程序时,图标变暗,但没有任何反应,并且整个手机短暂无响应。我的猜测是这发生在应用程序委托(delegate)中。我不确定发生了什么,但我认为我应该使用中央调度。

这是我目前在应用程序委托(delegate)中的代码,

import UIKit
import Firebase
import FirebaseMessaging

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
//Facebook SharedInstance FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
//Firebase Database
FIRApp.configure()
FIRDatabase.database().persistenceEnabled = true

//Onesignal PushNotifications
_ = OneSignal(launchOptions: launchOptions, appId: "3b2b4845-0b6a-4e92-892f-254c2cf51da8", handleNotification: nil)
_ = OneSignal(launchOptions: launchOptions, appId: "3b2b4845-0b6a-4e92-892f-254c2cf51da8", handleNotification: { (message, additionalData, isActive) in
NSLog("OneSignal Notification opened:\nMessage: %@", message)

if additionalData != nil {
NSLog("additionalData: %@", additionalData)
// Check for and read any custom values you added to the notification
// This done with the "Additonal Data" section the dashbaord.
// OR setting the 'data' field on our REST API.
if let customKey = additionalData["customKey"] as! String? {
NSLog("customKey: %@", customKey)
}
}
}, autoRegister: true)
print("didFinishLaunchingWithOptions launchOptions")
return true
}
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
print("application")
return FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
}

这是否可能与应用程序委托(delegate)无关?

如果它在应用程序委托(delegate)中,如何使用 GCD 来完成这项工作

最佳答案

删除

import FirebaseMessaging

FIRDatabase.database().persistenceEnabled = true

从 AppDeleget 并尝试运行它

关于ios - 只需单击启动图标,应用程序就会卡住我的整个手机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38879628/

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