Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18780] iOS: Add ability for Background Fetch tasks to support JSON responses

GitHub Issuen/a
TypeNew Feature
PriorityNone
StatusClosed
ResolutionNot Our Bug
Resolution Date2015-04-08T21:20:07.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterEduardo Gomez
AssigneeIngo Muschenetz
Created2015-04-06T18:01:59.000+0000
Updated2017-03-14T05:02:46.000+0000

Description

Feature Request

Add ability to get a JSON response for Background Fetch task. When you try to use same url using url session module, response doesn't contain text instead of data as empty JS object of "downloadcompleted" event.
[INFO]  e{"taskIdentifier":1,"data":{},"bubbles":true,"type":"downloadcompleted","source":{},"cancelBubble":false}
[INFO]  sessioncompleted {"errorCode":0,"taskIdentifier":1,"message":"","success":true,"bubbles":true,"type":"sessioncompleted","source":{},"cancelBubble":false}
[INFO]  Downloads completed successfully.
[INFO]  Download task :1 completed, success ? : true

Appcelerator Docs

http://docs.appcelerator.com/titanium/3.0/#!/guide/iOS_Background_Services

Sample Code

https://gist.github.com/egomez99/2d968326454e0dd8401c

Additional info

downloadcompleted event currently only supports Titanium.Blob data type for a download nsurlsession task. http://docs.appcelerator.com/platform/latest/#!/api/Titanium.App.iOS-event-downloadcompleted

Apple Docs

https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/URLLoadingSystem/URLLoadingSystem.html#//apple_ref/doc/uid/10000165i

Comments

  1. Vishal Duggal 2015-04-08

    Use JSON.stringify and Blob.text methods to convert blob data to JSON
  2. Lee Morris 2017-03-14

    Closing ticket as the issue is not our bug.

JSON Source