firebase,swift,ios – 无法获取默认标记Error Domain = com.firebase.iid Code = 6“(null)”

我正在做一个login应用程序,跟踪是否有人login。 我正在使用Firebase作为一种方式来做到这一点。 如果一个人不在firebase,他们不能login。

问题

我不断收到控制台错误

<FIRInstanceID / WARNING>无法获取默认标记Error Domain = com.firebase.iid Code = 6“(null)”

当我模拟应用程序。 当我尝试以Ash Dreyer身份login时,它不会login我。即使我已login到Firebase,也会多次单击它,所以应该将其注销并重新login。

火力地堡

 { "Ash Dreyer" : { "activity" : "None", "current_status" : "IN", "num_of_logins" : 0, "total_hours" : 0, "type" : "mentor" }, "Bryton Moeller" : { "activity" : "None", "current_status" : "OUT", "num_of_logins" : 0, "total_hours" : 0, "type" : "student" } } 

APP代理

 import UIKit import Firebase @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? override init() { FIRApp.configure() } func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { FIRApp.configure() return true } } 

LOGINVIEWCONTROLLER

 import Firebase import UIKit class LoginViewController: UIViewController { @IBOutlet weak var activity_label: UILabel! @IBOutlet weak var activity_picker: UIPickerView! @IBOutlet weak var name_field: UITextField! @IBOutlet weak var login_button: UIButton! @IBOutlet weak var location_switch: UISwitch! var root_ref = FIRDatabase.database().reference() // Color scheme let grey = UIColor(red: 0.933, green: 0.929, blue: 0.922, alpha: 1.0) let dark_orange = UIColor(red: 0.769, green: 0.396, blue: 0.176, alpha: 1.0) let dark_blue = UIColor(red: 0.188, green: 0.463, blue: 0.541, alpha: 1.0) let light_blue = UIColor(red: 0.412, green: 0.663, blue: 0.686, alpha: 1.0) let light_orange = UIColor(red: 0.871, green: 0.612, blue: 0.451, alpha: 1.0) var user: Person! func update_UI() { if let _ = user { if user!.current_status == "IN" { login_button.setTitleColor(dark_blue, for: UIControlState.normal) login_button.setTitle("LOG OUT", for: UIControlState.normal) } else { login_button.setTitleColor(dark_orange, for: UIControlState.normal) login_button.setTitle("LOG IN", for: UIControlState.normal) } } } func login(member: inout Person) { if member.current_status == "IN" { member.current_status = "OUT" } else { member.current_status = "IN" } root_ref.child(byAppendingPath: member.key).updateChildValues(["current_status": member.current_status]); update_UI() } func login_new_user(member_name: String) { root_ref.observe(FIRDataEventType.value, with: { (snapshot) -> Void in for member in snapshot.children { if member.key == member_name { self.user = Person(snapshot: member as! FIRDataSnapshot) } } }) if let _ = user { login(member: &user!) } } @IBAction func login_user(_ sender: UIButton) { if let _ = user, let name_text = name_field.text, name_text != "" { if user.key != name_text { login_new_user(member_name: name_text) } } else if let name_text = name_field.text, name_text != "" { login_new_user(member_name: name_text) } else if let _ = user { login(member: &user!) } else { print("Please enter text into the text field") } } @IBAction func toggle_location(_ sender: UISwitch) { } @IBAction func other_login(_ sender: UIButton) { } } 

笔记

  • 当我刚刚在func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool FIRApp.configure() ,它给了我一个SIGABRT错误。
  • 这是一个小组,我们正在跟踪,所以我决定使用名字,而不是UID。
  • 我正在使用Firebase 3

只需要更新,在使用模拟器的Xcode 8.2+版本时,这些错误不应再出现在最新版本的Firebase中。 有一个问题(实际上是一对夫妇)与模拟器,以及一些过分积极的日志logging在InstanceID。