0
您好我正在嘗試修復這個功能,直到swift 3完全正常,有人知道這個改變是什麼嗎?一旦用戶的位置已經被迅速發現,使當前位置顯示在地圖上3
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
if !didFindMyLocation {
let myLocation: CLLocation = change?[NSKeyValueChangeKey] as! CLLocation //Getting an error here Cannot convert value of type '(NSKeyValueChangeKey).Type' (aka 'NSKeyValueChangeKey.Type') to expected argument type 'DictionaryIndex<_, _>'
viewMap.camera = GMSCameraPosition.camera(withTarget: myLocation.coordinate, zoom: 10.0)
viewMap.settings.myLocationButton = true
didFindMyLocation = false
}
}