[TIMOB-24452] iOS: Handling responses from Ti.URLSession UploadTask API in the SDK
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-07-11T16:48:51.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 7.5.0 |
Components | n/a |
Labels | ios, networking |
Reporter | Richard Lustemberg |
Assignee | Hans Knöchel |
Created | 2017-03-03T13:11:49.000+0000 |
Updated | 2018-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
Hello, Please create the PR and assign here. Moving to TIBOB.
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?
Marking as Duplicate of MOD-2328 to centralize the communication.
Closing ticket as duplicate and links to the related ticket has been provided above.
Reopening since the other one was module-focussed and this one is SDK focussed. Assigning for our next release!
PR: https://github.com/appcelerator/titanium_mobile/pull/8860
Follow-up PR to fix the type warnings that only occurred after integrating into master: https://github.com/appcelerator/titanium_mobile/pull/10168
*Closing ticket.* Verified fix in SDK version
7.5.0.v20181018133006
. *Test Environment*