0
MapKit注釈(i)ボタンからUITableViewCellへの分割を試みています。これを実現するために、私は次のコードを使用しています:MapKitからUITableViewCellへの接続Firebaseのタッチでの注釈
func mapView(_ mapView: MKMapView, annotationView view: MKAnnotationView, calloutAccessoryControlTapped control: UIControl) {
let annotation = view.annotation as! MKPointAnnotation
let uid = annotation.title
self.userkey = uid!
self.performSegue(withIdentifier: "showDetailFromMap", sender: self)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "showDetailFromMap" {
let detailTVC = segue.destination as! MediaDetailTableViewController
let value = self.userkey
print(value)
let ref2 = DatabaseReference.media.reference()
let query2 = ref2.queryOrdered(byChild: "uid").queryEqual(toValue: (value))
query2.observe(.childAdded, with: { snapshot in
let media = Media(dictionary: snapshot.value as! [String : Any])
print(snapshot.value)
self.media1 = media
})
detailTVC.media = media1
detailTVC.currentUser = currentUser
}
}
を私はプリント(user.uid)でtableViewControllerのcellForRowでprint文を作り、これはfirebase後にprint文「予想外にnilを見つける」を投げています参照は何も返されていないので、これはfirebaseエラーで始まると思います。 firebaseクエリが実行されていないため、メディアが決して値を取得しません。何度もこのフォーマットで成功したクエリを実行しましたが、現在は動作していません。なぜどんなアイデア?