我正在尝试使用 GPS 查找当前位置。现在我在没有 GPS 的情况下获得当前位置。可能吗?提前致谢。
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.mapview.setRegion(region, animated: true)
var geocoder = CLGeocoder()
geocoder.reverseGeocodeLocation(location, completionHandler: { (placemarks, error) -> Void in
if (error != nil) {
// println("reverse geodcode fail: \(error.localizedDescription)")
let alert = UIAlertView()
alert.title = "Location"
alert.message = "Unable to find Where Am I !!"
alert.addButtonWithTitle("OK")
alert.show()
return
}
}