4

I've been trying to use the following method on Swift 5 to display the Bluetooth Accessory Picker:

DispatchQueue.main.async {
    EAAccessoryManager.shared().showBluetoothAccessoryPicker(withNameFilter: nameFilter, completion: nil)
}

But I get the following error:

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.

I've tried adding a Symbolic breakpoint, but it doesn't trigger. I've also tried calling this method from other parts of the code with different views, but still no success.

I'd really appreciate some help with this issue!

  • I'm experiencing this issue too, did you get around it? – Nkokhelox Mar 04 '21 at 11:04
  • for the picker to show, you need to add the `var window: UIWindow?` also see the question https://stackoverflow.com/questions/64794583/using-showbluetoothaccessorypicker-causes-scenedelegate-presenting-errors – Nkokhelox Mar 04 '21 at 11:27
  • Hey @Nkokhelox. I have already added the UIWindow var, which still doesn't make it work :( – Rafa Lucena Mar 08 '21 at 09:07

1 Answers1

0

It broke when Apple introduced the new Scene-based lifecycle. Roll back to the classic one and it starts working again. More details here: https://stackoverflow.com/a/70823487/415982

DrMickeyLauer
  • 4,455
  • 3
  • 31
  • 67