标签: cllocation

计算2坐标之间的距离iphone - 最佳实践

我正在完成一个应用程序希望我需要向用户显示他和大约500坐标之间的距离.

使用CLLocation方法计算它,效果很好,但在iPhone 4中大约需要1分钟才能完成每个位置的计算.

最好的方法是什么?用span?还有其他更快的方法吗

谢谢大家,

iphone distance cllocation cllocationdistance

0
推荐指数
1
解决办法
3103
查看次数

locationManager.location is always nil

I have essentially lifted this code from the internet:

//variables
//location manager
var locationManager:CLLocationManager!
var currentLocation:CLLocation?

//outlets
@IBOutlet weak var whatTextField: UITextField!
@IBOutlet weak var whereTextField: UITextField!
@IBOutlet weak var whenTextField: UITextField!

@IBAction func onCreateEventClick(_ sender: Any) {

    let event = CAEvent(eventId: "123777abc", eventName: whatTextField.text, location: currentLocation)
    event.save { (error) in
        //handle event error
        print(error)
    }
}

override func viewDidLoad() {
    super.viewDidLoad()
}

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)

    if( CLLocationManager.authorizationStatus() == .authorizedWhenInUse ||
        CLLocationManager.authorizationStatus() ==  .authorizedAlways){
        determineCurrentLocation()
    } …
Run Code Online (Sandbox Code Playgroud)

cllocation ios swift

0
推荐指数
1
解决办法
2210
查看次数

查看用户是否在某个位置附近?雨燕4

我希望能够查看用户是否位于 Swift 4 中其他位置的 5 公里半径范围内。

例如:

User Location: 37.785834, -122.406417
Other Location: -117.564011, 48.302353
Run Code Online (Sandbox Code Playgroud)

感谢任何提供帮助的人!

xcode cllocation swift swift4

0
推荐指数
1
解决办法
3296
查看次数

如何在 iOS 13 中使用`requestAlwaysAuthorization` 在 CLLocationManager 中请求地理定位?

Always Allow当应用程序requestAlwaysAuthorization在 iOS 13 中请求 CLLocationManager中的地理定位时,用户似乎无法获得该选项。它显示为Allow While Using AppAllow Once

环境:iOS 13 beta 6、Xcode beta 5、iPhone X

在此处输入图片说明

如何提示Always Allow用户?

geolocation cllocationmanager cllocation ios ios13

0
推荐指数
1
解决办法
593
查看次数