Saturday, May 25, 2013

Since various people have asked similar questions and the stack overflow thread I answered to has been locked to prevent it being spammed with comments I figured I may as well briefly address the subject here.

The questions are all really about the same thing but go along the lines of:

What happens if the app crashes?

How can I use more than one app?

The way to deal with this lies in the iOS URL addressing scheme. If you don't know what that is then go and RTFM over here.

One App To Rule Them All

Basically what you want to create is a main control app, or menu app. From this app you can re-open an app that has crashed or provide a menu to provide access to several apps. Lets look at the crash problem first.

Luckily when an app crashes (normally this means an uncaught exception has happened) iOS gives us one last chance to so something in the form of an uncaught exception handler. Now this handler is supposed to be used to provide a message to the user or maybe log a message but we can hijack it to open up our controller.

Now when your app crashes it will open up the main controller app which can either simply restart the app that crashed or provide a menu of apps to choose from.

To provide the ability to switch between apps without using the standard gesture based navigation which also allows users to get back to the springboard all you have to do is implement a menu/button in your app that opens the url to another app or over to the main controller using the same technique.