Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 关闭模式控制器后,TableView未重新加载firebase数据_Ios_Swift_Firebase_Google Cloud Firestore - Fatal编程技术网

Ios 关闭模式控制器后,TableView未重新加载firebase数据

Ios 关闭模式控制器后,TableView未重新加载firebase数据,ios,swift,firebase,google-cloud-firestore,Ios,Swift,Firebase,Google Cloud Firestore,在使用firebase Auth登录后,我尝试使用代理更新主页tableview,但遇到此问题时除外- 2020-07-16 10:58:51.078331-0700 Appname[44300:8867431] [AXRuntimeCommon] Unknown client: Appname 2020-07-16 10:58:51.084416-0700 Appname[44300:8867435] [AXRuntimeCommon] AX Lookup problem - errorCod

在使用firebase Auth登录后,我尝试使用代理更新主页tableview,但遇到此问题时除外-

2020-07-16 10:58:51.078331-0700 Appname[44300:8867431] [AXRuntimeCommon] Unknown client: Appname
2020-07-16 10:58:51.084416-0700 Appname[44300:8867435] [AXRuntimeCommon] AX Lookup problem - errorCode:1100 error:Permission denied portName:'com.apple.iphone.axserver' PID:44186 
应用程序加载后,会检查用户是否使用此功能登录主页

func isLoggedIn() {
        if Firebase.Auth.auth().currentUser == nil {
            perform(#selector(handleLogout), with: nil, afterDelay: 0)
        }
    }

    @objc func handleLogout() {
        
        do {
            try Auth.auth().signOut()
        } catch let logoutError {
            print("logout error", logoutError)
        }
        
        let startview = StartView()
        startview.home = self
        let nav = UINavigationController(rootViewController: startview)
        nav.modalPresentationStyle = .fullScreen
        present(nav, animated: false)
    }
然后在登录页面中,它将用户登录并从主页上运行该功能,但显示为空白

@objc func Login() {
Auth.auth().signIn(withEmail: EmailField.text!, password: PasswordField.text!) { [weak self] (user, error) in
       
        guard let StrongSelf = self else {
            return
        }
        guard let result = user, error == nil else {
            print(error!._code)
            self?.handleError(error!)
            return
        }
        
        let user = result.user
        print("logged in \(user)")

         //NotificationCenter.default.post(name: NSNotification.Name(rawValue: "loadhome"), object: nil)
        StrongSelf.navigationController?.dismiss(animated: true, completion: {
            self?.home.loadfirstusers()
        })
    }
}
    var home = HomePage()
它调用此函数来更新用户数据,并尽可能打印sameunisamecourse,但由于某种原因,它不调用dispatch.notify中的打印

func SameUniSameCourse(completion: @escaping (_ success: Bool) -> Void) {
        self.dispatchGroup.enter()
        service.loadUniversityAndCourse { (uni, course) in
        defer{ self.dispatchGroup.leave() }

            let usersRef = Firestore.firestore().collection("users").order(by: "Created", descending: true).whereField("University", isEqualTo: uni).whereField("Course", isEqualTo: course)
            self.dispatchGroup.enter()
            usersRef.getDocuments { (snapshot, error) in
            print("samecoursesameuni")
            defer{ self.dispatchGroup.leave() }
                
            if let error = error {
                print(error.localizedDescription)
                                    
            } else {
                for document in snapshot!.documents {
                    let data = document.data()
                    //print(data)
                    if let dictionary = data as [String:AnyObject]? {
                    let Info = UserInfo(dictionary: dictionary)
                    if Info.uid == Auth.auth().currentUser?.uid {
                        //print(Info.username)
                    }
                    else {
                    self.sameUniSameCourse.append(Info)
                        //print(Info.username!)
                }}}

                }
        }}
        self.dispatchGroup.notify(queue: .main) {
            print("dispatchNotifyCalled")
            if self.sameUniSameCourse.isEmpty == true {
                completion(false)
            }
            else {
                self.masterArray.append(contentsOf: self.sameUniSameCourse)
                self.spinner.stopAnimating()
                completion(true)
            }
      }
}