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

Expo imagepicker & Storage #54

Closed
andfk opened this issue Apr 16, 2017 · 3 comments
Closed

Expo imagepicker & Storage #54

andfk opened this issue Apr 16, 2017 · 3 comments

Comments

@andfk
Copy link

andfk commented Apr 16, 2017

Hi,

I switched from react-native-image-picker (that worked good initially with storage of this library) to the ImagePicker of expo SDK and when the image is selected it returns the param origURL with the format of assets-library:// but the optimal is to use the uri that comes in the format of file://.

{
  "cancelled":false,
  "height":1611,
  "width":2148,
  "uri":"file:///data/user/0/host.exp.exponent/cache/cropped1814158652.jpg"
}

Checking the source code, other format different than assets-library:// is not recognised. ContentType was automatically detected using react-native-image-picker with 1.0.0-alpha11 or at least I didn't have to specify it before and it was set in storage correctly but right now is not. Im using the assets-library:// from origURL and specifying manually the contentType, it works perfect.

Many thanks

@Salakar
Copy link
Member

Salakar commented Apr 16, 2017

@andfk not sure of the issue here, file:// paths should be supported, it's implemented here

Unless maybe this line is causing an issue? Could you comment out that line etc in your local copy, restart packager and rebuild - then see if it works?

@andfk
Copy link
Author

andfk commented Apr 16, 2017

@Salakar thanks for quick answer. I forgot to mention that im testing with IOS.

Well, i commented the line and replaced the param from _filePath to filePath.

// const _filePath = filePath.replace('file://', '');
    return new StorageTask(UPLOAD_TASK, FirebaseStorage.putFile(this.path, filePath, metadata), this);

The error still happens and noticed that in Xcode it shows the following:

Body file is unreachable: /Users/{$USER}/Library/Developer/CoreSimulator/Devices/F5A86517-C58A-4529-8289-91F0057AC873/data/Containers/Data/Application/0DF942A9-F53A-4B0F-AC6A-9754F4211942/Library/Caches/ExponentExperienceData/xpouser/ImagePicker/9125580B-9EF3-4AE7-B266-252BC550C65E.jpg
  Error Domain=NSCocoaErrorDomain Code=260 "The file “9125580B-9EF3-4AE7-B266-252BC550C65E.jpg” couldn’t be opened because there is no such file." UserInfo={NSURL=file:///Users/{$USER}/Library/Developer/CoreSimulator/Devices/F5A86517-C58A-4529-8289-91E0057AC573/data/Containers/Data/Application/0DF942A9-F53A-4B0F-AC6A-9754F4211942/Library/Caches/ExponentExperienceData/xpouser/ImagePicker/9125580B-9EF3-4AE7-B266-252BC550C65E.jpg, NSFilePath=/Users/${USER}/Library/Developer/CoreSimulator/Devices/F5A86517-C58A-4529-8289-91F0057AC873/data/Containers/Data/Application/0DF942A9-F53A-4B0F-AC6A-9754F4211942/Library/Caches/ExponentExperienceData/xpouser/ImagePicker/9125580B-9EF3-4AE7-B266-252BC550C65E.jpg, NSUnderlyingError=0x610000851df0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}

Is this helpful? i would like to help with this issue as much as i can. Is important to say that using origURL param where the file in the format of assets-library:// does the job, but i have to specify content type manually.

In use: ^1.0.0-alpha12 only tested on IOS for now.

Many thanks

@andfk
Copy link
Author

andfk commented Apr 19, 2017

Hi again. Did some checks but never did the most basic and simple test. Checking if the file really exists with the path provided. Seems some naming in the setup was causing the file to be unreachable, like error trace says. Tested again the storage module and it works perfect!

Many thanks for the great effort on this library.

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

2 participants