Skip to content

Terminal.shared.disconnectReader doesn't work when app is about to go in the background or terminate #330

@harsh7703

Description

@harsh7703

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions