-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TIMOB-17502] iOS: URLSession DownloadCompleted event now returns file url instead of TiBlob #6527
Conversation
if (!success) { | ||
DebugLog(@"Unable to copy temp file. Error: %@", [error localizedDescription]); | ||
} | ||
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithUnsignedInteger:downloadTask.taskIdentifier ],@"taskIdentifier",destinationURL,@"url", nil]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not change the event parameters at all. You could always create a TiBlob with a file path
TiBlob* data = [[[TiBlob alloc] initWithFile:[destinationURL path]] autorelease];
That way the signature remains the same and the data is still in a file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! that works and event parameters can stay the same.
Code Reviewed. Please address comments |
//copy downloaded file from location to tempFile (in NSTemporaryDirectory), because file in location will be removed after delegate completes | ||
NSError *error; | ||
NSFileManager *fileManager = [NSFileManager defaultManager]; | ||
NSString *destinationFilename = downloadTask.originalRequest.URL.lastPathComponent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to be a problem. What if the original URL in the request has no path component
http://www.myfileserved.com/
.
You could instead use the URL provided by the location
parameter
Code reviewed. Please address comments |
FT pass |
[TIMOB-17502] iOS: URLSession DownloadCompleted event now returns file url instead of TiBlob
JIRA: https://jira.appcelerator.org/browse/TIMOB-17502
To test: