【发布时间】:2016-10-20 09:16:56
【问题描述】:
应用程序在 iPhone 中运行,但是当我尝试在模拟器中运行时,它显示图像中给出的错误
请帮助我并在此感谢您
// 这是我的代码:
locationManager.delegate = self
var locManager = CLLocationManager()
locManager.requestWhenInUseAuthorization()
if (CLLocationManager.authorizationStatus() == CLAuthorizationStatus.AuthorizedWhenInUse ||
CLLocationManager.authorizationStatus() == CLAuthorizationStatus.Authorized)
{
let latitude1 = locManager.location!.coordinate.latitude.description
latitude = latitude1
let longitude1 = locManager.location!.coordinate.longitude.description
longnitude = longitude1
print(latitude)
print(longnitude)
} else {
latitude = ""
longnitude = ""
}
【问题讨论】:
-
试试这个链接stackoverflow.com/questions/214416/…这可能是你的答案
-
@Joe 我试过这个但没用
-
您是否尝试过 Xcode 中的任何默认模拟位置。请解释一下您的尝试。所以,我可以更好地理解,我们会找到解决问题的方法。
-
我刚刚创建了一个测试项目。我在模拟器中运行没有问题。你是否使用了正确的委托......
-
你能给我们看一些代码吗...
标签: swift ios-simulator core-location cllocationmanager