Tag: 调度

使用Firebase调用completionHandler

Folk,Plese我打破了我的头,这个问题..我从Firebase填充collectionView,(按照从YouTube上的一些教程( 让build设应用程序 ),并适应我的目标。 我在ViewDidLoad上的ControllerDetail上调用函数fetchePhotosApp,但照片不显示集合。 ControllerDetail.swift AppPhotos.fetchePhotosApp(pacienteID: self.paciente_key) { (appPhotos) in self.appPhotos = appPhotos self.collectionView?.reloadData() print("CALLING") } Models.swift static func fetchePhotosApp(pacienteID: String, completionHandler: @escaping ([AppPhotos]) -> ()) { let user = FIRAuth.auth()?.currentUser let appPhotos = AppPhotos() // var apps = [App]() // FIRDatabase.database().reference().child((user?.uid)!).child("photos").child(pacienteID).observeSingleEvent(of: .value, with: { (snapshot) in var newPhotos = [Photo]() for itemSnapShot in snapshot.children […]

dispatch_sync(dispatch_get_global_queue(xxx),任务)同步或asynchronous

正如苹果的文档所说,dispatch_get_global_queue()是一个并发队列,dispatch_sync是串行的意思。那么这些任务是asynchronous还是同步?