React-native: [0.59.0 and 0.59.1] CameraRoll cannot read image in iOS both simulator and real devices

Created on 15 Mar 2019  路  8Comments  路  Source: facebook/react-native

馃悰 Bug Report

There are 6 images in my iPhone, but Camera Roll reads none of them

To Reproduce

I test it careful by this way:
1/ Create a project using 0.58.6
2/ Link CameraRoll and able to read all images using 0.58.6
3/ Create a project using 0.59.0 and 0.59.1
4/ Also Link the CameraRoll carefully
5/ Copy and past the code runnable from 0.58.6 to 0.59.0 and 0.59.1
6/ Run the projects. The iPhone did ask me to access the Photo. I press "Yes" and it loads zero photo

Expected Behavior

Able to get all photo like it did in 0.58.6

Code Example

Here is my code for getting Photos:

export function initLibraryImageAndVideoList(success, fail) {

    let tasks = [];

    let task1 = CameraRoll.getPhotos({
        first: 1000000,
        assetType: 'Photos',
    });

    tasks.push(task1);

    let task2 = CameraRoll.getPhotos({
        first: 1000000,
        assetType: 'Videos',
    });

    tasks.push(task2);


    Promise.all(tasks)

        .then((results) => {

            let photoResult = results[0];  // <= Just consider photos

            let newList = photoResult.edges.map((item) => {
                return item.node.image.uri;
            });

            success(newList);

        })
        .catch((error) => {

            fail(error);
        });
}

Environment

info
React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: (4) x64 Intel(R) Core(TM) i5-2415M CPU @ 2.30GHz
Memory: 2.09 GB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.13.0 - /usr/local/bin/node
npm: 6.5.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 19, 21, 22, 23, 24, 25, 26, 27, 28
Build Tools: 23.0.1, 23.0.2, 25.0.0, 25.0.2, 26.0.2, 26.0.3, 27.0.3, 28.0.0, 28.0.1, 28.0.2, 28.0.3
System Images: android-18 | Google APIs Intel x86 Atom, android-19 | Google APIs Intel x86 Atom, android-21 | Google APIs Intel x86 Atom, android-22 | Google APIs Intel x86 Atom, android-23 | Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom_64, android-24 | Google Play Intel x86 Atom, android-25 | Google Play Intel x86 Atom, android-26 | Google Play Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5056338
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.1 => 0.59.1
npmGlobalPackages:
react-native-cli: 2.0.1

CameraRoll Bug Image iOS Locked

Most helpful comment

Getting the same issue here.
For some reason requesting with groupTypes: 'All', give me back pictures with an uri starting with ph:// that are not processable.

All 8 comments

@truongluong1314520 I'm fighting through the same issues as you, the worst being the inability to build my android project because of the camera roll. On the IOS side, though, if you add the following parameters to your lookup you should get some results. They are not properly sorted but at least you should get images: assetType:'Photos',groupTypes:'all'

Thank you @jcharbo , I will definitely try it

@jcharbo I am able to get images now. Thank you a lot

Getting the same issue here.
For some reason requesting with groupTypes: 'All', give me back pictures with an uri starting with ph:// that are not processable.

CameraRoll used to give back an ALAssetsLibrary URI which was formatted as assets-library://. Now it gives back a PHAsset URI, formatting it as ph://. Neither of these seem to work with Image - they give no image.

However, with CameraRoll linked the assets-library URIs do give an image... then the app crashes. Not a JS crash, a crash in the native code. Except on certain phones, that work fine.

Giving a URI of a different format (eg photos:// which is how some other libraries have chosen to go) causes a JS crash in Image stating that it does not recognize it.

Yeah, this is a bit of a showstopper at the moment. I can't do anything with the images that come out of CameraRoll when it comes to networking.

Hi @samparmenter, your issue may related to this one.

iOS - returned uri cannot be used for upload image to server

This piece of work is suspended in project, and waiting for any better solution. 馃槅

Was this page helpful?
0 / 5 - 0 ratings