showBluetoothAccessoryPicker(withNameFilter:completion:)
Displays an alert that allows the user to pair the device with a Bluetooth accessory.
Declaration
func showBluetoothAccessoryPicker(withNameFilter predicate: NSPredicate?, completion: (@Sendable ((any Error)?) -> Void)? = nil)func showBluetoothAccessoryPicker(withNameFilter predicate: NSPredicate?) async throwsParameters
- predicate:
The predicate is evaluated using the name of the Bluetooth accessory. The picker displays only devices with names that match the predicate. If you specify
nil, this method displays all discovered accessories. - completion:
A completion block to execute when the picker is dismissed. Use this block to track any errors that might occur during the pairing process.
Discussion
On iOS devices, this method synchronously displays an alert containing the list of Bluetooth accessories that have been discovered by the current device and that match the specified filter (if any). The user can select an accessory from this list and pair the device to it. Pairing an accessory updates the accessory manager’s list of connected accessories and generates a corresponding connection notification. On Apple silicon, this method displays an alert to let the user know that the Bluetooth accessory picker is unavailable.