Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Booking.com close their app programmatically?

I just saw this trick the Booking.com app does to let you change the application's language:

booking.com app

I'm not aware of any technique to programmatically close an iOS app (and it's also forbidden by Apple's guidelines, but let's "pretend" that my boss wants me to do this).

How do they do it? I've tried exit(0) but it immediately quit like when the process crashes, while their app animates to the home screen normally. Is there maybe a private URL scheme that opens the home screen?

like image 539
Tamás Zahola Avatar asked Sep 26 '18 09:09

Tamás Zahola


1 Answers

You can try

// after change language dim display and follow it with this snippet
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
    UIApplication.shared.perform(#selector(NSXPCConnection.suspend))
     DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
      exit(0)
     }
}

I have done it many times in similar cases and the app accepted without rejection

like image 127
Sh_Khan Avatar answered Oct 18 '22 06:10

Sh_Khan