2017-02-24 7 views
0

こんにちは私は迅速に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 
    } 

} 

答えて

1

あなたは以下のように適切なキーを提供する必要があります:

let myLocation: CLLocation = change?[NSKeyValueChangeKey.newKey] as! CLLocation 
関連する問題