> At no point did you initialize these two variables before using
> them in your application, which may simply be a piece of code you
> left out to simplify your sample code.
Apologies; I forgot to include their initialization in the sample code I posted. But my real code they *are* initialized - and now that I can debug volume mounting, I have verified with the debugger that they are indeed initialized correctly - so, that's not the problem.
Another thing. The documentation says that "SysUIAppSwitch sends the current application an appStopEvent and then starts the specified application.". (Surprisingly, this interesting bit of information is in the description of SysAppLaunch - *not* in the description of SysUIAppSwitch, sigh.) But, I'm calling SysUIAppSwitch from a notification, when no application is displaying any user interface yet (that's the whole point - I couldn't make my application display its user interface when receiving the notification). It's the Launcher's user interface that is being displayed when the notification arrives.
OK, so I tried using SysAppLaunch instead of SysUIAppSwitch. Yes, I know that an application launched via SysAppLaunch doesn't have access to its global variables - but it doesn't matter to me, because I've rewritten mine not to use any global variables. Now, after my application launches itself via SysAppLaunch, it *does* receive the custom launch code and starts acting on it, as the debugging shows.
Unfortunately, as soon as I enter the event loop, I receive an appStopEvent (huh?!), so the loop terminates immediately and my application exits. *After* it has exited, I get a crash because of a null pointer reference. :-((
I really don't understand how this OS works. :-((( Can somebody point me to some sample code of an application launching itself with a custom launch code? When I receive control with the custom launch code from SysAppLaunch, do I have to eat events until the first appStopEven and only *then* enter my normal event loop??