When my iOS (peripheral) starts advertising, I instantly re-run my app, at this point, my computer (central) was in middle of subscribing to a characteristic and writing to it.
Once my peripheral app finishes launching, something goes wrong (probably because central was previously trying to write to it) and my app crashes with this message:
*** Assertion failure in -[CBPeripheralManager respondToRequest:withResult:], /SourceCache/CoreBluetooth/CoreBluetooth-256/CBPeripheralManager.m:423
I never call "respondToRequest" in my code, all of my peripheral's characteristics are configured as follows (WriteWithoutResponse):
let properties: CBCharacteristicProperties = [CBCharacteristicProperties.Read, CBCharacteristicProperties.WriteWithoutResponse, CBCharacteristicProperties.Notify]
let permissions: CBAttributePermissions = [CBAttributePermissions.Readable, CBAttributePermissions.Writeable]
When I write to the characteristics from the Centra's end, I use:
writeValue(chunkOfData, forCharacteristic: charactristic, type: CBCharacteristicWriteType.WithoutResponse)
I'm not sure how to prevent this issue. Any ideas please?