我正在使用 FaSTLane 创建快照。由于我的应用程序使用“推送通知”,当应用程序启动时,它总是向用户显示请求授权发送此类消息的弹出窗口。在 AppDelegate UIApplication.shared.registerForRemoteNotifications()
中调用了一个方法,该方法是向用户“显示”弹出窗口的方法。
我试过类似的东西:
#if !DEBUG
UIApplication.shared.registerForRemoteNotifications()
#endif
#if TARGET_IPHONE_SIMULATOR
UIApplication.shared.registerForRemoteNotifications()
#endif
我也尝试过设置一个全局变量,但是一直找不到设置这个变量的地方,因为它永远不起作用
我总是得到同样的行为。
我预计第一次在模拟器中运行测试时,它不会显示消息。
谢谢。
最佳答案
我找到了一种避免此屏幕截图的简单方法。
在截取屏幕截图之前,我只需按下“允许”按钮
let systemAlerts = XCUIApplication(bundleIdentifier: "com.apple.springboard").alerts
if systemAlerts.buttons["Allow"].exists {
systemAlerts.buttons["Allow"].tap()
}
简单又容易:)
关于swift - 有没有办法去除 FaSTLane 截图中的 Push Notification Pop Up 确认消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56024759/