mar*_*tus 20 cllocationmanager xcode7 swift2 xcode7-beta2
我用Swift 2将Xcode 6更新为Xcode 7 beta.我收到此错误,我无法找到解决方法,请帮助我.谢谢.这是我的代码:
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [AnyObject]) {
let location = locations.last as! CLLocation
let center = CLLocationCoordinate2D(latitude: location.coordinate.latitude, longitude: location.coordinate.longitude)
let region = MKCoordinateRegion(center: center, span: MKCoordinateSpan(latitudeDelta: 0.01, longitudeDelta: 0.01))
self.map.setRegion(region, animated: true)
}
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
Objective-C method 'locationManager:didUpdateLocations:' provided by method 'locationManager(_:didUpdateLocations:)' conflicts with optional requirement method 'locationManager(_:didUpdateLocations:)' in protocol 'CLLocationManagerDelegate'
小智 39
和你有同样的问题,改变
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [AnyObject])
Run Code Online (Sandbox Code Playgroud)
至
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation])
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
11129 次 |
最近记录: |