無論何時我向「places」字典中添加項目時,它都會顯示錯誤,我基本上希望我的應用在用戶點擊地圖時添加註釋,並希望註釋具有「通道」和「subThoroughfare」。 然後註釋文本應該更新爲另一個viewController.swift文件中的表格。我想讓字典更新的地方我無法將項目添加到「places」字典中?
它要求我用逗號替換分號。
這裏是爲全局變量的代碼:
var places = [Dictionary<String,String>()]
現在我已經用在我已經把下CLGeocode功能的代碼另一個viewController.swift文件這個變量,而我追加的字典,它要求我用逗號:
places.append("name":title, "lat":"\(newCoordinate.latitude)", "lon",:"\(newCoordinate.longitude)")
let annotation = MKPointAnnotation()
annotation.coordinate = newCoordinate
annotation.title = title
self.map.addAnnotation(annotation)
它仍然不能正常工作,它顯示了這個錯誤: –
預期分離「」 –
加名之前開閉架,然後最後一個字段的值 –