在我的应用程序中,我accessory为我的home对象添加了一个支持 HomeKit 的对象。这是一个灯泡,我可以从应用程序成功打开/关闭。
但是,每次打开/关闭它时,我都会在 Xcode 控制台中看到这些日志:
2020-06-02 11:07:07.753864-0700 HomeKitStarter[759:312859] [Activity] [writeValue:completionHandler: (C030358E-8F98-4E43-8E43-6E498B50D62C)] Thread left active (1): <NSThread: 0x283c54b40>{number = 1, name = (null)}
2020-06-02 11:07:08.638182-0700 HomeKitStarter[759:312859] [Activity] [writeValue:completionHandler: (0E28FC72-FDEE-4625-93A3-F5939F878CE5)] Thread left active (1): <NSThread: 0x283c54b40>{number = 1, name = (null)}
2020-06-02 11:07:09.418971-0700 HomeKitStarter[759:312523] [Activity] [writeValue:completionHandler: (8E371920-B6E6-4363-90C7-019C6FA82895)] Thread left active (1): <NSThread: 0x283c54b40>{number = 1, name = (null)}
Run Code Online (Sandbox Code Playgroud)
有谁知道为什么要记录“线程保持活动状态”?
为什么UUID每次写入都会发生变化?
我正在使用Firebase构建一个应用程序,该应用程序使用一个初始文件SignInViewController加载登录页面,供用户通过电子邮件进行身份验证,从而触发以下方法:
@IBAction func didTapSignIn(sender: AnyObject) {
let email = emailField.text
let password = passwordField.text
FIRAuth.auth()?.signInWithEmail(email!, password: password!) { (user, error) in
if let error = error {
print(error.localizedDescription)
return
}
self.signedIn(user!)
}
}
func signedIn(user: FIRUser?) {
AppState.sharedInstance.displayName = user?.displayName ?? user?.email
AppState.sharedInstance.signedIn = true
NSNotificationCenter.defaultCenter().postNotificationName(Constants.NotificationKeys.SignedIn, object: nil, userInfo: nil)
performSegueWithIdentifier(Constants.Segues.SignInToHome, sender: nil)
}
Run Code Online (Sandbox Code Playgroud)
该SignInViewController还检查是否有缓存的当前用户,当应用程序启动,如果是这样,迹象表明,用户在:
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(true)
//Synchronously gets the cached current user, or null if there is none.
if let user …Run Code Online (Sandbox Code Playgroud)