Summary
I want to disconnect the reader when the app is supposed to go in the background state or let's say it is about to terminate. This same code works when the app is foreground but does not work when the app is about to switch its state.
Code to reproduce
NotificationCenter.default.addObserver(self, selector: #selector(appWillEnterBackground), name: UIApplication.willResignActiveNotification, object: nil)
func appWillEnterBackground() {
Terminal.shared.disconnectReader { error in
if let error = error {
print("Disconnect failed: \(error)")
} else {
print("--------------- Disconnected --------------")
}
}
}
iOS version
18.0.1
Installation method
Cocoapods
SDK version
3.9.1
Other information