【发布时间】:2020-12-09 10:32:21
【问题描述】:
我一直在尝试在 Swift 5 上使用以下方法来显示蓝牙配件选择器:
DispatchQueue.main.async {
EAAccessoryManager.shared().showBluetoothAccessoryPicker(withNameFilter: nameFilter, completion: nil)
}
但我收到以下错误:
A constraint factory method was passed a nil layout anchor. This is not allowed, and may cause confusing exceptions. Break on BOOL _NSLayoutConstraintToNilAnchor(void) to debug. This will be logged only once. This may break in the future.
我尝试添加一个符号断点,但它没有触发。我也试过用不同的视图从代码的其他部分调用这个方法,但仍然没有成功。
非常感谢您对这个问题的帮助!
【问题讨论】:
-
我也遇到了这个问题,你解决了吗?
-
要显示选择器,您需要添加
var window: UIWindow?,另请参阅问题stackoverflow.com/questions/64794583/… -
嘿@Nkokhelox。我已经添加了 UIWindow var,但仍然无法正常工作:(
标签: ios swift external-accessory mfi