swift - 如何允许在 UITest 中进行跟踪?
问题描述
我试图调用“addUIInterruptionMonitor”来获取应用程序跟踪透明度通知,但它没有注册并且在我的下一步中失败。有关此对话框描述的任何帮助都会有所帮助,“系统对话框”不起作用。
“允许...跟踪您在其他公司的应用程序和网站上的活动”“要求应用程序不要跟踪”“允许”
addUIInterruptionMonitor(withDescription: "System dialog") {
(alert) -> Bool in
if alert.buttons["Cancel"].exists {
alert.buttons["Cancel"].tap()
self.app.activate()
return true
}
return false
}
解决方案
找到解决方案,我使用的描述是“跟踪使用权限警报”
测试本身也是一个问题,等待一个按钮出现,该按钮仅在回答此对话框后出现
addUIInterruptionMonitor(withDescription: "Tracking Usage Permission Alert") {
(alert) -> Bool in
if alert.buttons["Allow"].exists {
alert.buttons["Allow"].tap()
self.app.activate()
return true
}
return false
}
推荐阅读
- ios - UIScrollView 在 Autolayout 或缩放后停止滚动
- java - 在文件选择器中包含我自己的示例图片(Intent.ACTION_PICK)
- javascript - 如何在javascript中创建对象数组?
- mongodb - 一些MongoDB聚合时如何保留旧字段?
- android - Google Play In-app Billing API 版本低于 3 并更新了 Play Store
- cluster-computing - 如何在 R 中的稀疏相关矩阵上应用层次聚类(NaN 相异值)?
- django - 为什么我们需要“序列化”模型字段属性?
- python - 为什么 Pythonw 文件占用大量 CPU 资源?
- sql - 在创建过程 pl sql 中返回布尔值
- c - 设置私有后设置公钥的目的是什么?