gpt4 book ai didi

ios - Google Map SDK 和 iOS,observeValueForKeyPath 问题

转载 作者:搜寻专家 更新时间:2023-11-01 06:21:14 24 4
gpt4 key购买 nike

我正在关注 Google MAP SDK Tutorial对于 iOS,几乎一切都很好,但是这个功能

override func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject, change: [String : AnyObject], context: UnsafeMutablePointer<Void>) {
if !didFindMyLocation {
let myLocation: CLLocation = change[NSKeyValueChangeNewKey] as! CLLocation
viewMap.camera = GMSCameraPosition.cameraWithTarget(myLocation.coordinate, zoom: 10.0)
viewMap.settings.myLocationButton = true

didFindMyLocation = true
}
}

"Method does not override any method from its superclass"

Xcode 7 swift 2谷歌地图 iOS SDK

有什么想法吗?

谢谢

最佳答案

你能试试这个吗?更新了最新版本的 Swift 的代码。看起来该示例是基于旧版本的 Swift。

override func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [String : AnyObject]?, context: UnsafeMutablePointer<Void>) {
if !didFindMyLocation {
let myLocation: CLLocation = change![NSKeyValueChangeNewKey] as! CLLocation
viewMap.camera = GMSCameraPosition.cameraWithTarget(myLocation.coordinate, zoom: 10.0)
viewMap.settings.myLocationButton = true

didFindMyLocation = true
}
}

关于ios - Google Map SDK 和 iOS,observeValueForKeyPath 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33709744/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com