Skip to content

Commit

Permalink
fix(iOS): audioPlayers.isEmpty EXC_BAD_ACCESS (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
longtn-imt authored Feb 22, 2024
1 parent 1d36b4d commit 9901c3f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ios/Classes/SwiftAlarmPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,11 @@ public class SwiftAlarmPlugin: NSObject, FlutterPlugin {
}

private func stopNotificationOnKillService() {
if audioPlayers.isEmpty && observerAdded {
NotificationCenter.default.removeObserver(self, name: UIApplication.willTerminateNotification, object: nil)
observerAdded = false
safeModifyResources {
if self.audioPlayers.isEmpty && self.observerAdded {
NotificationCenter.default.removeObserver(self, name: UIApplication.willTerminateNotification, object: nil)
self.observerAdded = false
}
}
}

Expand Down

0 comments on commit 9901c3f

Please sign in to comment.