应用程序在模拟器中工作,但不在设备上

时间:2016-09-21 20:54:10

标签: ios firebase firebase-realtime-database swift3

我的应用程序在模拟器上运行正常,但是当我在设备上运行时,它会挂在第一个视图上。它不会在viewDidLoad或viewDidAppear中调用任何内容。运行swift 3,iOS 10,设备是6S更新到iOS 10.

import UIKit
import Firebase
import SwiftKeychainWrapper

class FirstVC: UIViewController {

override func viewDidLoad() {
}

override func viewDidAppear(_ animated: Bool) {
    // MARK: Checks if you have an account and never logged out
    if let userId = KeychainWrapper.defaultKeychainWrapper().stringForKey(KEY_UID) {
        DataService.ds.REF_USERS.child(userId).observeSingleEvent(of: .value, with: { (FIRDataSnapshot) in
            guard let dict = FIRDataSnapshot.value as? NSDictionary, let setup = dict["setup"] as? Bool else {
                self.performSegue(withIdentifier: "firstToDemo", sender: nil)
                return
            }
            if setup {
                self.performSegue(withIdentifier: "firstToPollBar", sender: nil)
            } else {
                self.performSegue(withIdentifier: "firstToDemo", sender: nil)
            }
        })
    } else {
        self.performSegue(withIdentifier: "firstToLogin", sender: nil)
    }
}

}

0 个答案:

没有答案