Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19333] iOS: URLSession Module not working properly if system terminates the app during download

GitHub Issuen/a
TypeBug
PriorityNone
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterShawn Lan
AssigneeUnknown
Created2014-11-27T03:12:04.000+0000
Updated2018-02-28T19:55:17.000+0000

Description

If the system terminates the app during a download, after the download finishes (the app remains not running), there are some problems: 1. backgroundtransfer is the last event fired (should be the first) 2. downloadcompleted event handler doesn't get the file blob (evt.data.size==0) If the system terminates the app during a download, before the download finishes, you launch the app and cancel the download, there is one problem: 1. The partially downloaded file is remained in the storage, not cleaned up. UPDATE: With SDK 4.1.0, it seems the partially downloaded file is cleaned up in this scenario. These issues didn't exist in previous SDKs, as I've tested it before. To simulate system terminating the app: 1. download a large enough file 2. during the download, using the Studio to build the app to the device 3. App installed successfully on the device, causing the running instance terminated by the system 4. test the above two scenarios.

Attachments

FileDateSize
app.zip2014-12-03T02:00:56.000+00008485566

Comments

  1. Shuo Liang 2014-11-27

    Hi, Please provide a simple test case for this problem, that will be helpful to address the issues. Thanks. Regard, Shuo
  2. Shawn Lan 2014-12-03

    okay I attached a simple test app.
  3. Shawn Lan 2015-08-20

    The reason for the first issue is that in my app the session is created right away at launch. I do so because I need to update the download progress to the users. If I don't need the session to be created at launch, then I can just create session after "backgroundtransfer" is fired. That way, the first issue is gone. Even so it's still a bug. The "backgroundtransfer" should always be the first to fire no matter what. And like I said, I need the session be created at launch. UPDATE: downloadcompleted event handler doesn't get the file blob (evt.data.size==0) --- this issue seems fixed with SDK 4.1.0 (or with latest iOS version)

JSON Source