2

我目前有一个应用程序会尝试自动发现 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>.

这确实有道理。当前选择器正在显示,然后尝试显示另一个警报以验证引脚和配对。

但是,如果我删除 中的 Application Scene Manifest info.plist,删除SceneDelegate并删除 中的所有UISceneSession Lifecycle功能AppDelegate它就可以工作了..

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

有没有人遇到过这个问题?

4

0 回答 0