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 failed if app is running in the background in React Native #179

Open
iqbalfaisal opened this issue Feb 5, 2020 · 17 comments
Open
Labels

Comments

@iqbalfaisal
Copy link

Describe the bug
Upload failed if app is running in the background in React Native. Specially in IOS

Setup details
Please provide following details, if applicable to your situation:

  • Runtime environment: React Native
  • Used tus-js-client version: ^1.8.0-2
@iqbalfaisal iqbalfaisal added the bug label Feb 5, 2020
@Acconut
Copy link
Member

Acconut commented Feb 6, 2020

Please provide more details to allow us to reproduce this. However, AFAIK, iOS does not allow arbitrary background activities so it's possible that there is nothing we can do if iOS decides to kill your app if it is put into background.

@iqbalfaisal
Copy link
Author

@Acconut
IMG-20200206-WA0000

@Acconut
Copy link
Member

Acconut commented Feb 10, 2020

@iqbalfaisal A screenshot is not sufficient to allow us to reproduce this. Please provide the minimal code and instructions so we can trigger the same error.

@iqbalfaisal
Copy link
Author

@Acconut this error will trigger when the picture is uploading and App goes to background and came back in IOS

@iqbalfaisal
Copy link
Author

@Acconut sorry i forgot to mention. App should be in release mode on real device rather than emulator

@Acconut
Copy link
Member

Acconut commented Feb 10, 2020

I personally don't have an iOS device or emulator available, so I cannot debug this. Maybe @ifedapoolarewaju could help or you, @iqbalfaisal, might be able to take a look on your own.

@iqbalfaisal
Copy link
Author

@Acconut i tried but failed. Kindly solved this because my app is delaying due to this problem

@Acconut
Copy link
Member

Acconut commented Feb 10, 2020

It's unfortunate that your app is delayed. If it's very urgent for you, we can talk about private paid support.

@iqbalfaisal
Copy link
Author

@ifedapoolarewaju are you there?

@BilawalGul
Copy link

Yes @iqbalfaisal you're right. I'm facing the same error. Let me know when you find something useful. I think core contributor is not serious about the library.

@Acconut
Copy link
Member

Acconut commented Feb 11, 2020

I think core contributor is not serious about the library.

That's not a very nice claim about the work that we put into this open source project and provide to you free of any charge.

You should know that background uploads on iOS is not something we do not care about but even our native Objective-C SDK cannot do, because iOS simply doesn't allow it. I don't want to go into details but instead refer you to tus/TUSKit#57 where you can read more. So we are inherently limited in what we can do.

@iqbalfaisal
Copy link
Author

That's not a very nice claim about the work that we put into this open source project and provide to you free of any charge.

I know @Acconut. I really appreciate your time and effort also your team.

You should know that background uploads on iOS is not something we do not care about but even our native Objective-C SDK cannot do, because iOS simply doesn't allow it. I don't want to go into details but instead refer you to tus/TUSKit#57 where you can read more. So we are inherently limited in what we can do.

Yes i had read this but question is why App is crashing. I Know Apple not allow background processes but Tus-Client should send error in OnError function or just stop uploading without crashing the whole App. I hope you understand my point.

Thanks

@BilawalGul
Copy link

Really sorry if you hurt @Acconut

@Acconut
Copy link
Member

Acconut commented Feb 12, 2020

Thanks for the kind words and the explanation, @iqbalfaisal. If I understand it now correctly, there are two problems:

  1. tus-js-client cannot upload a file while the app is in background on iOS
  2. tus-js-client causes an unrecoverable crash if the app is put into background while an upload is running.

Problem 1 cannot be solved directly since it's a restricting from iOS (unless you use the location hack as in tus/TUSKit#57).

Problem 2 should be solvable but I can't work on it personal because I don't have access to an iOS device or emulator. So help is in this regard greatly appreciated if you want to see this problem fixed.

@iqbalfaisal
Copy link
Author

Problem 2 should be solvable but I can't work on it personal because I don't have access to an iOS device or emulator. So help is in this regard greatly appreciated if you want to see this problem fixed.

Yes @Acconut i'm talking about this problem. I have spent whole day to sort out this problem but unfortunately i have failed and frustrated. I have put this problem in future TODO list and going to release the my App. Thanks for the giving me yours important time.

@abdulmomin703
Copy link

abdulmomin703 commented Apr 5, 2023

@iqbalfaisal the issue is not related to tus-js-client. Instead, it is caused by a bug in core react-native. You can view the details and solution here.
facebook/react-native#31392

@Acconut
Copy link
Member

Acconut commented Apr 6, 2023

@iqbalfaisal Thank you for the info. If I read it correctly, this fix was not yet included in any release, but will make it into 0.72.0? reactwg/react-native-releases#54

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

No branches or pull requests

4 participants