Post

Replies

Boosts

Views

Activity

How to make third party peripheral discoverable using iOS 18 AccessorySetupKit
As the new feature is launched I also want to make user experience smoother in my app using the AccessorySetupKit. But my peripheral is not discoverable. But another ios device with same advertisement data is discoverable by AccessorySetupKit. I didn't find much information on the documents related to the third party connection. I'm not sure if the third party peripheral should be MFI supported or anything else is required. Is there anything I'm missing here to fullfill the requirement, please let me know. Below is the code i"m using to discover the peripheral. Once again iOS to iOS discovery is working, facing issue with third party peripheral is not discovering. private var session = ASAccessorySession() var pickerDismissed = true private static let perepheral: ASPickerDisplayItem = { let descriptor = ASDiscoveryDescriptor() descriptor.bluetoothServiceUUID = PublisherClass.serviceUUID return ASPickerDisplayItem( name: "Test_Name", productImage: UIImage(named: "sample")!, descriptor: descriptor ) }() override func viewDidLoad() { super.viewDidLoad() self.session.activate(on: DispatchQueue.main, eventHandler: handleSessionEvent(event:)) } @IBAction func presentPicker() { session.showPicker(for: [Self.perepheral]) { error in if let error { print("Failed to show picker due to: \(error.localizedDescription)") } } } private func handleSessionEvent(event: ASAccessoryEvent) { switch event.eventType { case .accessoryAdded, .accessoryChanged: guard let accessory = event.accessory else { return } print("\(accessory)") case .activated: guard let accessory = session.accessories.first else { return } print("\(accessory)") case .accessoryRemoved: print("Received event type accessoryRemoved)") case .pickerDidPresent: pickerDismissed = false case .pickerDidDismiss: pickerDismissed = true default: print("Received event type \(event.eventType)") } } } I also added these details in plist NSAccessorySetupKitSupports Bluetooth NSAccessorySetupBluetoothServices
0
0
242
Aug ’24