Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24452] iOS: Handling responses from Ti.URLSession UploadTask API in the SDK

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2018-07-11T16:48:51.000+0000
Affected Version/sn/a
Fix Version/sRelease 7.5.0
Componentsn/a
Labelsios, networking
ReporterRichard Lustemberg
AssigneeHans Knöchel
Created2017-03-03T13:11:49.000+0000
Updated2018-10-23T09:53:46.000+0000

Description

Version 2.1.0 of ti.urlsession has support for NSURLSessionUploadTask. Once the NSURLRequest is completed, the sessioncompleted event is fired with a success status, because the request received it's response. However, the response might have been a 401,still a success code would be set, because NSURLSessionUploadTask does not care for HTTP error statuses. We might also want to handle the response code after the upload task is completed. To do this we only need to add a delegate method from NSURLSessionDataDelegate and modify the sessioncompleted delegate. I will make a PR with the required changes, which are adding:
-(void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data
and modify this other delegate method:
-(void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error

Comments

  1. Sharif AbuDarda 2017-03-03

    Hello, Please create the PR and assign here. Moving to TIBOB.
  2. Richard Lustemberg 2017-03-03

    I've renamed my branch to this Jira ticket and made the PR again. Do we need to apply again to have rights to create TIMOB tickets?
  3. Hans Knöchel 2017-03-08

    Marking as Duplicate of MOD-2328 to centralize the communication.
  4. Lee Morris 2017-03-22

    Closing ticket as duplicate and links to the related ticket has been provided above.
  5. Hans Knöchel 2018-06-28

    Reopening since the other one was module-focussed and this one is SDK focussed. Assigning for our next release!
  6. Hans Knöchel 2018-06-28

    PR: https://github.com/appcelerator/titanium_mobile/pull/8860
  7. Hans Knöchel 2018-07-11

    Follow-up PR to fix the type warnings that only occurred after integrating into master: https://github.com/appcelerator/titanium_mobile/pull/10168
  8. Samir Mohammed 2018-10-23

    *Closing ticket.* Verified fix in SDK version 7.5.0.v20181018133006. *Test Environment*
       APPC Studio: 5.1.0.201808080937
       iPhone 6 Sim (iOS 12)
       APPC CLI: 7.0.6
       Operating System Name: Mac OS Mojave
       Operating System Version: 10.14
       Node.js Version: 8.9.1
       Xcode 10.0

JSON Source