【发布时间】:2015-11-04 23:31:20
【问题描述】:
看过之前的帖子,但没有一个解决方案适合我。
我收到此错误:
Objective-C 方法 'locationManager:didUpdateLocations:' 由提供 方法 'locationManager(_:didUpdateLocations:)' 与 可选要求方法 'locationManager(_:didUpdateLocations:)' 在协议“CLLocationManagerDelegate”中
使用以下代码:
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let location = locations.last
let center = CLLocationCoordinate2D(latitude: location!.coordinate.latitude, longitude: location!.coordinate.longitude)
let region = MKCoordinateRegion(center: center, span: MKCoordinateSpan(latitudeDelta: 1, longitudeDelta: 1))
self.mapView.setRegion(region, animated: true)
self.locationManager.stopUpdatingLocation()
}
【问题讨论】:
-
只是为了确认一下,你是否包含了coreLocation框架
import CoreLocation -
投票结束,因为不可复制
标签: swift swift2 cllocationmanager cllocation