我使用这段代码来检查我是否有访问用户位置的权限
if CLLocationManager.locationServicesEnabled() {
switch CLLocationManager.authorizationStatus() {
case .restricted, .denied:
hasPermission = false
default:
hasPermission = true
}
} else {
print("Location services are not enabled")
}
}
而 Xcode(12) 用这个警告提醒我:
'authorizationStatus()' was deprecated in iOS 14.0
那么替代品是什么?
#available
检查。 - Rob