Skip to content

[iOS] cannot access media stats from cameraroll with RN 0.59.1 #337

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

Open
sulagarde opened this issue Mar 29, 2019 · 8 comments
Open

[iOS] cannot access media stats from cameraroll with RN 0.59.1 #337

sulagarde opened this issue Mar 29, 2019 · 8 comments

Comments

@sulagarde
Copy link

  • please provide the version of installed library and RN project.
    rn-fetch-blob v.0.10.15
    react-native v.0.59.1

Since I upgraded react-native 0.59.1 I cannot get stats from iOs files:
Error: failed to stat path ph://9F983DBA-EC35-42B8-8773-B597CF782EDD/L0/001 because it does not exist or it is not a folder.

@dmitryame
Copy link

I'm also having issues uploading to AWS s3 with the fetch after upgrading RN to 0.59.x.
The issue here is that CameraRoll.saveToCameraRoll returns URI that is prefixed with ph:// instead of assets-library://, as the result the RNFetchBlob.fetch('PUT',.. does not return any error, but uploads 0 bytes.

@RafikiTiki
Copy link

I don't have any experience in native side of development for iOS but I've tracked down that react-native changed the way uri is formatted in 0.59.x and above versions.

Pre 0.59 code: https://github.com/facebook/react-native/blob/0.58-stable/Libraries/CameraRoll/RCTCameraRollManager.m#L202

0.59+ code: https://github.com/facebook/react-native/blob/master/Libraries/CameraRoll/RCTCameraRollManager.m#L131

@dmitryame
Copy link

dmitryame commented Apr 19, 2019

Yep, this seems to be correct.
So, is it going to be addressed by the rn-fetch-blob? Because as of now, I can not use it with rn 0.59.x.

@samparmenter
Copy link

samparmenter commented May 10, 2019

rn-fetch-blob is no longer maintained and won't receive any updates by the looks of it.

You can get around it by doing something like this but I don't imagine its very robust

uri = ph://9F983DBA-EC35-42B8-8773-B597CF782EDD/L0/001
ext = 'jpg'; // or heic or png etc
uri = uri.replace('ph://', '');      
localIdentifier = uri.split('/')[0]; // leaves 9F983DBA-EC35-42B8-8773-B597CF782EDD
filePath = `assets-library://asset/asset.${ext}?id=${localIdentifier}&ext=${ext}`; // this you can pass into rn-fetch-blob stuff

This isn't my fix but it seems to at least work for now

@dmitryame
Copy link

Thank you for your reply, really appreciate it.
And this is very unfortunate news, because I was only able to get AWS upload to work correctly with rn-fetch-blob . I wonder, what are the other alternatives people use these days for this kind of stuff.
Thanks.

@20pro
Copy link

20pro commented May 13, 2019

rn-fetch-blob is no longer maintained and won't receive any updates by the looks of it.

You can get around it by doing something like this but I don't imagine its very robust

uri = ph://9F983DBA-EC35-42B8-8773-B597CF782EDD/L0/001
ext = 'jpg'; // or heic or png etc
uri = uri.replace('ph://', '');      
localIdentifier = uri.split('/')[0]; // leaves 9F983DBA-EC35-42B8-8773-B597CF782EDD
filePath = `assets-library://asset/asset.${ext}?id=${localIdentifier}&ext=${ext}`; // this you can pass into rn-fetch-blob stuff

This isn't my fix but it seems to at least work for now

@samparmenter Why rn-fetch-blob won't receive any update ?

@zoozalp
Copy link

zoozalp commented May 23, 2019

@samparmenter Why rn-fetch-blob won't receive any update ?

see #359

@akontaroudis
Copy link

akontaroudis commented Oct 20, 2019

rn-fetch-blob is no longer maintained and won't receive any updates by the looks of it.

You can get around it by doing something like this but I don't imagine its very robust

uri = ph://9F983DBA-EC35-42B8-8773-B597CF782EDD/L0/001
ext = 'jpg'; // or heic or png etc
uri = uri.replace('ph://', '');      
localIdentifier = uri.split('/')[0]; // leaves 9F983DBA-EC35-42B8-8773-B597CF782EDD
filePath = `assets-library://asset/asset.${ext}?id=${localIdentifier}&ext=${ext}`; // this you can pass into rn-fetch-blob stuff

This isn't my fix but it seems to at least work for now

Has this worked for anyone? Trying to copy a file with cp where the source file being an assets-library path results in an empty file to the destination path.

For what is worth using react-native-fs with copyAssetsFileIOS and formatting the path with the above code snippet seems to work. I guess there's most probably an issue with rn-fetch-blob itself.

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

7 participants