使用showBluetoothAccessoryPicker会导致SceneDelegate出现错误

问题描述

我目前有一个应用程序,它将尝试自动发现MFi蓝牙设备。

唯一的方法是使用ExternalAccessory框架,因为CoreBluetooth仅用于文件Ble设备。

现在我有一个执行的按钮:

EAAccessoryManager.shared().showBluetoothAccessoryPicker(withNameFilter: nil) { error in }

要显示选择器,我需要在var window: UIWindow?内添加AppDelegate

到目前为止,这可行。选择器显示,并将列出我要连接的设备。但是,当我尝试单击要配对的设备时,会显示以下消息:

2020-11-11 14:07:16.694761-0700 BT[500:48034] [Presentation] Attempt to present <UIAlertController: 0x105013a00> on <_TtGC7SwiftUI19UIHostingControllerV2BT11ContentView_: 0x104a0a510> (from <_TtGC7SwiftUI19UIHostingControllerV2BT11ContentView_: 0x104a0a510>) which is already presenting <UIAlertController: 0x105052800>.

这确实有意义。当前,选择器正在显示,然后尝试显示另一个警报以验证图钉和对。

但是,如果我删除info.plist中的“应用程序场景清单”,则删除SceneDelegate并删除UISceneSession Lifecycle中的所有AppDelegate函数,它可以工作 ..

问题是我需要SceneDelegate,因为它是一个swiftUI应用程序,否则将无法运行。

以前有人遇到过这个问题吗?

解决方法

目前陷入一个非常相似的问题。如果您知道了,让我知道!

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...