File tree Expand file tree Collapse file tree
core/src/appleMain/kotlin Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import kotlinx.coroutines.flow.MutableSharedFlow
66import kotlinx.coroutines.flow.collect
77import kotlinx.coroutines.flow.flow
88import platform.Foundation.NSData
9+ import platform.Foundation.NSLog
910
1011/* *
1112 * Manages observations for the specified [peripheral].
@@ -55,7 +56,13 @@ internal class Observers(
5556 }
5657 } finally {
5758 if (observers.decrementAndGet(characteristic) < 1 ) {
58- peripheral.stopNotifications(characteristic)
59+ try {
60+ peripheral.stopNotifications(characteristic)
61+ } catch (e: NotReadyException ) {
62+ // Silently ignore as it is assumed that failure is due to connection drop, in which case the system
63+ // will clear the notifications.
64+ NSLog (" Stop notification failure ignored." )
65+ }
5966 }
6067 }
6168 }
You can’t perform that action at this time.
0 commit comments