showBluetoothAccessoryPicker

It doesn't work.


I have an MFi device paired but not connected in my Bluetooth devices list. The manufacturer says it does IAP. Even with a nil predicate, the showBluetoothAccessoryPicker brings up an empty screen (and when it does that, it logs this nasty message about "This NSLayoutConstraint is being configured with a constant that exceeds internal limits" (that people have been complaining about for a couple of years). Having the MFi device already connected also doesn't cause the Picker to show it.


Am I doing something wrong, or is this just messed up?


Barry

It doesn't work.


Really, without details of your code, of what you expect, of what you get, this is useless.


Even with a nil predicate, the showBluetoothAccessoryPicker brings up an empty screen

Show the code


it logs this nasty message about "This NSLayoutConstraint is being configured with a constant that exceeds internal limits" (that people have been complaining about for a couple of years)

Show the messages

The picker views only unpaired MFi devices.
The EAAcessory framework does not provide an API to connect to a device.

The MFi device can initiate connection to the iPhone - so if your device can supports GATT you can use CoreBluetooth to connect to the device and ask it to connect over iAP.
Another options is the "bridging" feature mentioned in the last WWDC session about CoreBluetooth - with this feature the iPhone connects to the classic bluetooth device when it discover this device over BLE.

TomerN,

thanks for your reply. This function would not be useful at all if it only finds unpaired devices. So it finds an unpaired device (which I first had to manually put into pairing mode), lists the device, I select it (which causes it to pair) and then it never shows up again? The doc does say "pairs the device" so you are probably right.


So I tried it that way. Did "Forget This Device" on one of them, put it into pairing mode (which causes it to show up at the bottom of my Bluetooth Settings in "Other Devices"), ran the picker, and it still gives me a screen with no items.


I've opened trouble ticket FB7545602.


For your other suggestions, good ideas, but these devices don't do BLE and so no GATT.

When i tried to show picker on current top controller i'm getting a warning to present on rootviewcontroller only not on top view controller

Warning: Attempt to present <UIAlertController: 0x1580a1e00> on <adingViewController: 0x157d64110> whose view is not in the window hierarchy!


And picker doesn't show up. if i call showBluetoothAccessoryPicker in rootview controller getting a constranit 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.


And once picker pops up screen becomes blank with picker and after picker dismissal whole viewcontroller becomes balnk.

Hi Barry

I also have the same problem, but I successfully to show bluetooth accessory picker now. If your project have SceneDelegate.swift file, maybe you can try this method.

  1. Added var window: UIWindow? property in AppDelegate.swift class

  2. Deleted Application Scene Manifest entry from Info.plist

  3. Deleted SceneDelegate.swift file

  4. Deleted all scene related methods(UISceneSession Lifecycle) in AppDelegate.swift class

Any updates on this issue? It still happens on iOS 14. It seems to be linked to the introduction of SceneDelegate (was Apple using a UIAlertView?).

I cannot delete the SceneDelegate, so any alternative solution would be appreciated
Same here. It seems not to be working with SceneDelegate.
showBluetoothAccessoryPicker
 
 
Q