Skip to content
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

Upload does not resume after the app has been killed and restarted #200

Open
dennismoje opened this issue Feb 10, 2025 · 0 comments
Open

Comments

@dennismoje
Copy link

The upload of a file does not continue correctly after killing and restarting the app.

Steps to reproduce the error

  1. Start TUSKitExample and select a large file to upload (e.g. 150MB)
  2. Go to the iOS home screen and close the app with the swipe gesture
  3. Restart TUSKitExample. The upload will not be continued
  4. Close TUSKitExample again and restart it. The upload will now continue.

Tested with iOS 18.3

Unfortunately, the error is not forwarded to the TUSClientDelegate so that the user is not aware of it.

Short analysis
The following method is called within Self.tusClient.start(): api.checkTaskExists and then session.getAllTasks.
session.getAllTasks returns the previous task even after a kill of the app.
completion(hasTask) therefore returns true.

However, the task immediately ends in a failed. However, the error is not passed to the user at this point:

class: TUSClient.swift Method: reregisterCallbacks

self.api.registerCallback({ result in
 task.taskCompleted(result: result, completed: { _ in })
 }, forMetadata: metadata)

The error here is the following:
failure(TUSKit.TUSClientError.couldNotUploadFile(underlyingError: TUSKit.TUSAPIError.underlyingError(Error Domain=NSURLErrorDomain Code=-999 "(null)" UserInfo={NSURLErrorBackgroundTaskCancelledReasonKey=0, NSErrorFailingURLStringKey=myurl, NSErrorFailingURLKey=myurl, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"BackgroundUploadTask <7B808DB7-FC94-48A5-B803-B749BD220559>.<4>",
"LocalUploadTask <7B808DB7-FC94-48A5-B803-B749BD220559>.<4>"
), _NSURLErrorFailingURLSessionTaskErrorKey=BackgroundUploadTask <7B808DB7-FC94-48A5-B803-B749BD220559>.<4>})))

It would be good if the error also ends up in the TUSClientDelegate or the error is handled internally so that the upload is continued.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant