我使用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)
}

我得到这个错误:
Objective-C method 'locationManager:didUpdateLocations:' provided by method 'locationManager(_:didUpdateLocations:)' conflicts with optional requirement method 'locationManager(_:didUpdateLocations:)' in protocol 'CLLocationManagerDelegate'

最佳答案

只是和你有同样的问题,改变

func locationManager(manager: CLLocationManager, didUpdateLocations locations: [AnyObject])


func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation])

关于cllocationmanager - Swift 2 CLLocationManager更新错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31044885/

10-13 02:37