Bru*_*ter 5 ios swift swiftui ios14
我正在编写一个 iOS14+ 应用程序,试图使用.onChange(of: scenePhase)
它来代替进入前台或后台的应用程序。
但是当系统对话框弹出时(例如,要求配对设备时),我收到了该.inactive
阶段 - 这与旧的 didEnterBackground/foreground 不同!
我目前不进行任何后台处理,因此我没有收到阶段.background
- 只是.inactive
然后.active
再次。因此,\xe2\x80\x99s 没有简单的方法来区分系统对话框和实际进入后台之间的区别。
我想知道用户是否离开了我的应用程序并回来了。以后就不能用了吗?我不想使用旧的已弃用的方法。
\n这可以解决问题。
\n.onReceive(NotificationCenter.default.publisher(\n for: UIScene.willEnterForegroundNotification)) { _ in \n\xe2\x80\xa6\n}\n\n
归档时间: |
|
查看次数: |
1709 次 |
最近记录: |