【发布时间】:2017-11-24 23:42:28
【问题描述】:
我正在尝试使用以下方式访问用户坐标:
import MapKit
import CoreLocation
override func viewDidLoad() {
super.viewDidLoad()
let locationManager = CLLocationManager()
let userCoordinates = (locationManager.location?.coordinate)!
}
但是,它在模拟器加载时崩溃。我将模拟器位置设置为 Apple,并将隐私密钥输入到 info.plist,但我不确定为什么这没有获取用户位置。
【问题讨论】: