Skip to content

Instantly share code, notes, and snippets.

@ebruning
Created July 25, 2013 22:03
Show Gist options
  • Save ebruning/6084205 to your computer and use it in GitHub Desktop.
Save ebruning/6084205 to your computer and use it in GitHub Desktop.
Restart application
http://stackoverflow.com/questions/5082738/ios-calling-app-delegate-method-from-viewcontroller
http://stackoverflow.com/questions/4399611/force-iphone-app-to-restart-programmatically
// call delegate method
MainClass *appDelegate = (MainClass *)[[UIApplication sharedApplication] delegate];
[appDelegate.viewController resetAppToFirstController];
- (void)resetAppToFirstController
{
self.window.rootViewController = [[MyMainViewController alloc] initWithNibName:nil bundle:nil];
// Add other navigation setup
}
@bansalvks
Copy link

how to do it in cocoa application? I want to restart my cocoa application
thank you :)

@Agm91
Copy link

Agm91 commented Oct 3, 2018

is there a way to do this on swift?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment