[TIMOB-1357] iOS: App Close event on IOS4 not fired
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Trivial |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-07-25T12:04:05.000+0000 |
Affected Version/s | Release 1.5.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | gero |
Assignee | Neeraj Gupta |
Created | 2011-04-15T02:50:20.000+0000 |
Updated | 2012-07-26T22:26:32.000+0000 |
Description
The App's close event is not fired under iOS4.
If you press the home button, double click the home button and close the app from the "running tasks" bar (which is the way to really close an app under iOS4) no log output appears and no properties are saved with this code:
Ti.App.addEventListener('close',function() {
Ti.API.info("Saving close event info");
Ti.App.Properties.setInt('closeevent', 1);
});
Dont't mix up with #982 - this is a iOS4 problem. The above code works with iPhone OS 3.2.
Tested in simulator and on device.
Note that the operating system does not actually inform a suspended application when it gets terminated -- there is no way to catch this condition. Apps need to perform all their cleanup when they're informed that they're being suspended; if an event isn't currently fired for that, it really needs to be.
Thank you for your appraisal. In this case, maybe the close event should by fired on suspension for iOS4 -- for compatibility.
For now: there is no documented event for suspension to make a workaround for this issue -- am I missing something?
Firing close on suspend is probably a bad idea, since apps are likely to assume that 'close' means their code will DEFINITELY not come back and they may do things like closing out windows and UI elements; the result would be a broken app if it's reactivated.
I'm not aware offhand of a suspend event existing yet (I'm not a member of the development team, just another user.)
Because of how the shutdown framework works there is no guarantee this event listener will ever even be fired. Requires R&D, going to bump.
Tested with app with
UIApplicationExitsOnSuspend = YES
(required for iOS 4.0+). Unable to reproduce in SDK 2.2.0.f9e938d, iPhone Sim 5.1.