Skip to content

Instantly share code, notes, and snippets.

@aplekhanov
Created January 22, 2016 13:22
Show Gist options
  • Save aplekhanov/d62bebe89ab6e6b4037a to your computer and use it in GitHub Desktop.
Save aplekhanov/d62bebe89ab6e6b4037a to your computer and use it in GitHub Desktop.
Programmatically exit from iOS app
// not for app store apps, 'cause wil be rejected !!!
// can be useful for in-house development needs
UIApplication *app = [UIApplication sharedApplication];
[app performSelector:@selector(suspend)];
// wait two seconds while app is going to background
[NSThread sleepForTimeInterval:2.0];
// when exit app when it is in background
exit(0);
// app screenshot still will be at mulitask view
// but it's only show recent apps
// actually, you've exit from current app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment