Wednesday, December 16, 2015

Kill a running iPhone App

Problem:

We had a situation in an app where the user should not be able to proceed without accepting a condition.  We had the view prompt them when they chose to exit.  The method called Thread.Abort() which lead to an error report.

Solution:

Using the System library, call the CloseMainWindow().  This will gracefully kill the app and return control back to the base OS.

system.diagnostics.process.getcurrentprocess().CloseMainWindow()

Source:

http://forums.xamarin.com/discussion/12026/close-an-application-programmatically
http://stackoverflow.com/questions/3622120/monotouch-reuse-uialertview

No comments:

Post a Comment