Closed dev-pac closed 11 months ago
Modification: working correctly in 1.4.1
Aha! I know why this is happening!! scanForPeripherals
will resume with an async stream, but the enqueue
call stays awaiting until the stream completes. Turning off Bluetooth does not terminate the stream. So you're probably calling cancelAllOperations
when the bluetooth is turned off, which tries to send an operationCancelled
to the enqueued operations. But since the scanForPeripherals
continuation has already been used, the app crashes.
I'm going to want to re-think the strategy here, but I have a quick workaround for this. Stay tuned....
Cool; thanks
Version: from 1.7.0 (not tested earlier)
Steps to reproduce:
result:
Thread 5: Fatal error: SWIFT TASK CONTINUATION MISUSE: scanForPeripherals(withServices:options:) tried to resume its continuation more than once, throwing operationCancelled!
in CentralManaager().scanForPeripherals(...) in the catch block, line 87
expected: