We want to use AccessorySetupKit to pair our BLE accessories. However, currently all our products announce the same BLE service UUID. The manufacturer data is different for every product.
I try to pair our products with ASK and create the ASDiscoveryDescriptor with the expected manufacturer data:
let descriptorA = ASDiscoveryDescriptor()
descriptorA.bluetoothServiceUUID = CBUUID("CE1EB45C-1BD2-45BE-8163-ACC88BE94CB2") // same
descriptorA.bluetoothManufacturerDataBlob = Data([0xd2, 0x0a, 0x00, /* A */ 0x2a, 0x00, 0x00, 0x00]) // different
descriptorA.bluetoothManufacturerDataMask = Data([0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff])
let descriptorB = ASDiscoveryDescriptor()
descriptorB.bluetoothServiceUUID = CBUUID("CE1EB45C-1BD2-45BE-8163-ACC88BE94CB2") // same
descriptorB.bluetoothManufacturerDataBlob = Data([0xd2, 0x0a, 0x00, /* B */ 0x2b, 0x00, 0x00, 0x00]) // different
descriptorB.bluetoothManufacturerDataMask = Data([0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff])
However, it seems random which device is found, as if the service UUID is the primary key to handle things in ASK.
My questions are:
Is it possible to use only manufacturer data to distinguish between different products with the same service UUID?
How do I use bluetoothManufacturerDataMask properly? I assume that internally some filtering like this is done: DataBlob & DataMask == ReceivedManufacturerData & DataMask. Because of that I have set all bits of the mask to 1. Should this e done differently?
Post
Replies
Boosts
Views
Activity
We're facing a reproducible crash on iOS 17 that seems to be related to our ToolbarItems. It happens when we tear down a NavigationStack (by setting all navigationDestination Bindings to false), where the same view is present multiple times in the stack.
This happens in about 20% of the time and only on a real iOS device:
Simultaneous accesses to 0x144a23a60, but modification requires exclusive access. Previous access (a modification) started at SwiftUI` + 12312 (0x1a5595a34).
The stacktrace goes from [UIBarButtonItem dealloc] -> AG::Subgraph::notify_observers() -> swift::runtime::AccessSet::insert(swift::runtime::Access*, void*, void*, swift::ExclusivityFlags)
The "Current access (a read) started at:" info points to a very similar stacktrace (see the screenshot I linked below).
I failed to attach the crash report to this post, but have uploaded it here: https://www.dropbox.com/scl/fi/7lrwkuhge0dmz1grv9r3r/SwiftUI-ToolbarItem-Crash.txt?rlkey=pu0x835y25uy38r605qflhhtm&dl=0.
This is the Stacktrace from Xcode:
https://www.dropbox.com/scl/fi/fdijajvq60jd7wawlsdjr/SwiftUI-ToolbarItem-Crash.png?rlkey=m05ahqihliji32udbcmd6yz0a&dl=0
Is there anything I can do to narrow down the root cause? A workaround would be to remove the ToolbarItems and fake a navigation controller, but I would like to avoid such hacks.