2017-02-24 1 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 
관련 문제