0
私は新しい開発者です。私は現在、私の最初のアプリを作っています。 アプリを開くときに、アイコンが暗くなりますが、何も起こらず、携帯電話全体が一時的に反応しなくなります。私の推測では、これはアプリケーションデリゲートで起こっています。私は何が起こっているかは分かりませんが、私は巨大な中央派遣を使うべきだと思います。起動アイコンをクリックするだけで、私の電話全体がフリーズする
これは現在、アプリのデリゲートの私のコードです、
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)
}
それは、このアプリのデリゲートとは何の関係もないことが、可能ですか?
それがこの作品
、それを実行してみ作るためにGCDを使用することができますどのようにアプリのデリゲートである場合'FIRApp.configure()'は何ですか?それともFirebase独自の方法の1つですか? – paulvs
ブレークポイントを設定し、一度に1行ずつコードをステップ実行します。問題の原因となる行を確認してください。あるいは、アプリケーションがフリーズしたら、一時停止ボタンをクリックしてデバッガに入り、メインスレッドで何が起きているのかを確認します。 –
ありがとうございます、私はブレークポイントを設定しようとしています – slimboy