我正在运行R Studio服务器。我需要设置一组参数来获得火花,我通常使用
import Foundation
import MapKit
class UserLocation: NSObject, CLLocationManagerDelegate{
var mLocationManager: CLLocationManager
var placemark: CLPlacemark
override init(){
placemark = CLPlacemark()
self.mLocationManager = CLLocationManager()
self.mLocationManager.desiredAccuracy = kCLLocationAccuracyBest
self.mLocationManager.requestWhenInUseAuthorization()
self.mLocationManager.startUpdatingLocation()
}
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
CLGeocoder().reverseGeocodeLocation(manager.location!, completionHandler: {(placemarks, error) -> Void in
if (error != nil) {
print("Error: " + (error?.localizedDescription)!)
return
}
if (placemarks?.count > 0) {
let pm = placemarks![0]
self.placemark = pm
print(self.placemark.areasOfInterest)
self.mLocationManager.stopUpdatingLocation()
}
})
}
func locationManager(manager: CLLocationManager, didFailWithError error: NSError) {
print("Error: " + (error.localizedDescription))
}
func getPlacemark() -> CLPlacemark{
return self.placemark
}
}
通过shell。
我希望它可以通过R studio自动获取,而无需将所有参数重新复制到其他位置。有什么建议吗?