ios - 如何使隐私请求弹出窗口脱颖而出?重新安装应用程序时弹出窗口被白屏覆盖
问题描述
我的应用程序使用来自 iPhone 的位置数据。为此,在启动应用程序时请求数据保护数据 - 它可以工作。但是,如果我从 iPhone 上删除应用程序进行新的测试并重新启动调试器,iPhone/iPad 上的显示仍然是白屏,并且由于没有位置数据,调试器会生成错误。iPhone 不会询问给予什么样的许可。该查询仅在我关闭 iPhone 上的应用程序时显示(不是使用调试器或在调试器中)。为什么 - 发生了什么?有谁知道解决方案?
如果我关闭应用程序并且空白屏幕消失,则弹出窗口变得可见。如果我然后选择“AuthorizedAlways”或“AuthorizedWhenInUse”(在请求弹出窗口中),应用程序将按需要运行......为什么将查询放在后台或为什么查询被空白屏幕覆盖以及如何我可以解决这个问题吗?回答位置查询后,一切正常。但是没有显示!或被白屏覆盖。
这里是一个记录器输出,直到调试器终止:0 --- AppDelegate: application (_: didFinishLaunchingWithOptions:)>)
1 --- 可观察:初始化(值:)>)
2 --- 品牌:init ()>) 2020-10-18 09:23:02.559857 + 0200 Observer2 [2003:698275] 金属 API 验证已启用
3 --- ViewController1: viewDidLoad()>)
4 --- ViewController1:setUpLocationManager()>)
5 --- ViewController1: checkLocationAuthorization ()>)
授权状态():0
致命错误:在展开可选值时意外发现 nil:文件 Observer2 / ViewController1.swift,第 143 行 2020-10-18 09:23:15.747456 + 0200 Observer2 [2003:698275] 致命错误:在展开可选值时意外发现 nil :文件 Observer2 / ViewController1.swift,第 143 行
//---------------------------------------------
override
func viewDidLoad() {
super.viewDidLoad()
setUpLocationManager()
checkLocationServices() /// <----
setUpMapView()
checkLocationAuthorization()
/// ....
}
/// ....
func checkLocationAuthorization() {
if locationManager?.location == nil {
locationManager = CLLocationManager()
locationManager!.requestAlwaysAuthorization()
locationManager!.requestWhenInUseAuthorization()
}
startAuthorizationStatus = CLLocationManager.authorizationStatus()
switch startAuthorizationStatus! {
case .authorizedWhenInUse: /// = 4
/// do Map Stuff
// startTrackingUserLocation()
break
case .denied:
/// show alert instructing them how to turn on permissions
break
case .notDetermined: /// = 0
locationManager!.requestWhenInUseAuthorization()
if startAuthorizationStatus == .notDetermined {
locationManager!.requestAlwaysAuthorization()
locationManager!.requestWhenInUseAuthorization()
startAuthorizationStatus = CLLocationManager.authorizationStatus()
}
break
case .restricted: /// = 1
/// show alert instructing them know what's up
break
case .authorizedAlways:
// startTrackingUserLocation() /// = 3
break
default:
print("unknown Switch case")
break
} /// switch
}
解决方案
推荐阅读
- python - 如何结束while循环以获得最大公因数
- python - Python 根据行索引拆分数据框
- unit-testing - 如何在 Ionic 中创建 AlertController 模拟
- php - Laravel 5.6 Auth Login 页面错误未显示刀片
- r - r中的数据框用于存储表格数据?
- javascript - 在 Azure 函数中处理 POST 请求以将文件上传到 Blob 存储
- ubuntu - 在 Ubuntu 中创建一个可以 sudo 的用户(Dockerfile)
- excel - 指定范围和图纸的边框
- neo4j - 如何使用两个查询的结果集作为 Cypher 中第三个查询的参数?
- semantic-ui - 语义 UI 反应超级英雄 Dropdown.Item 突出显示