gpt4 book ai didi

ios - 为什么LocationManager在iOS模拟器中没有被调用,但是在手机上却被调用了?

转载 作者:行者123 更新时间:2023-11-29 02:09:02 25 4
gpt4 key购买 nike

//in my viewDidLoad()
self.locationManager.requestWhenInUseAuthorization()
self.locationManager.delegate = self
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest
self.locationManager.startUpdatingLocation()
self.locationManager.startMonitoringSignificantLocationChanges()

if CLLocationManager.authorizationStatus() == CLAuthorizationStatus.Denied{
println("location not authorized")
}


//somewhere down the file

func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) {
println("Location") //this prints on the phone, not simulator
self.locationManager.stopUpdatingLocation()
}

我的 plist 中还有“NSLocationWhenInUseUsageDescription”。

enter image description here

最佳答案

只需从这里重置您的模拟器:

enter image description here

希望对你有帮助。

关于ios - 为什么LocationManager在iOS模拟器中没有被调用,但是在手机上却被调用了?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29484134/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com