这里是我的getMapAnnotations()函数,它应该从firebase数据库获取纬度和经度信息,并将这些注释添加到mapView:
func getMapAnnotations() {
print("aa")
var refHandle = self.ref.child("tasks").observeEventType(FIRDataEventType.Value, withBlock: { (snapshot) in
let tasksDict = snapshot.value as? NSDictionary
print("bb")
for i in 0 ..< tasksDict!.count {
let taskId = tasksDict!.allKeys[i] as! String
print (taskId)
let task = tasksDict!.objectForKey(taskId) as! NSDictionary
print (task)
let lat = task.objectForKey("latitude") as! String
let long = task.objectForKey("longitude") as! String
let latNum = Double(lat)
let longNum = Double(long)
let latDegrees: CLLocationDegrees = latNum!
let longDegrees: CLLocationDegrees = longNum!
let pointLocation: CLLocationCoordinate2D = CLLocationCoordinate2DMake(latDegrees, longDegrees)
let point = MKPointAnnotation()
point.coordinate = pointLocation
point.title = task.objectForKey("title") as? String
self.homeMap.addAnnotation(point)
print("point added")
}
当视图控制器加载且断点位于pointLocation声明时,应用程序将无响应。有什么我不在这里做的吗?感谢。
答案 0 :(得分:0)
我在那条线上设置了一个断点。哦,那个人很尴尬。