[TIMOB-2693] Add background cleanup handlers for termination/suspend
| GitHub Issue | n/a | 
|---|---|
| Type | Bug | 
| Priority | Low | 
| Status | Closed | 
| Resolution | Fixed | 
| Resolution Date | 2013-11-12T21:50:50.000+0000 | 
| Affected Version/s | n/a | 
| Fix Version/s | Release 1.6.0 M04 | 
| Components | iOS | 
| Labels | background, cleanup, defect, ios, release-1.6.0 | 
| Reporter | Stephen Tramer | 
| Assignee | Stephen Tramer | 
| Created | 2011-04-15T03:27:11.000+0000 | 
| Updated | 2013-11-12T21:51:00.000+0000 | 
Description
	It looks like there are points in shutdown/suspend where we need to ensure that certain operations are completed (such as
user-defined callbacks, analytics, etc.) We need to ensure that all of these are done before suspend/termination is complete on iOS 4.0+.
In particular, see the comment on this commit: https://github.com/appcelerator/titanium_mobile/commit/3165d74ad25b899f6d820b2ca76352fe13d9001a
Termination is still on a 5s countdown. From the Apple documentation: "However, if your application is currently running in the background state (in other words, not suspended), the system calls the applicationWillTerminate: method of your application delegate. *Your application cannot request additional background execution time from this method.* Otherwise, analytics events which are queued now have their dispatch completed before shutdown."
(from [0a81aa09fe73b5261b897390ee99b11f824a6498]) [#2693 state:fixed-in-qa] Background execution support for analytics. No other BG handlers appear to be needed at this time. https://github.com/appcelerator/titanium_mobile/commit/0a81aa09fe73b5261b897390ee99b11f824a6498"> https://github.com/appcelerator/titanium_mobile/commit/0a81aa09fe73...
To test this bug:
Start KS
Repeatedly FG/BG the app as quickly as possible
Watch analytics output; you should be seeing analytics events sent from the background (the reachability status info in the log is a good indicator this is happening).
Successful iPhone and iPad test on 01/28/2011
Mobile SDK version: 1.6.0 (01/26/11 18:53 bd12917...)
iPhone Version: iPhone 4 / 4.2.1
iPad Version: 4.2.1