Completion handler when another app has been closed?

As the title says, right now my application have one function which can open another application by using UIApplication.shared.open and also i have a completion handler in this method as well.

if(self.bankinfo.bankIDOpenUrl != "" && self.bankinfo.bankIDSessionID != ""){
                UIApplication.shared.open(URL(string: self.bankinfo.bankIDOpenUrl)!, options: [:]) { success in
                    // handle success/failure
                    if success {
                        print("success")
                    }else{
                        print("failed")
                    }
                }
            }

The completion handler is wroking fine, it will activate when the other application has been opened, but this is not what im looking for. Is there any way you can set one listener to listen when the other application is closed?

Replies

Is there any way you can set one listener to listen when the other application is closed?

No. iOS’s sandbox prevents you from examining the state of other apps.

One alternative approach is to have the target app open a URL that brings your app back to the front when it’s done, but that only works if you have the cooperation of the target app.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thanks Quinn! I will check that.