Why require CAMERA_ROLL permission for ImagePicker in v27?

#1

in Expo v26, ImagePicker.launchImageLibraryAsync/launchCameraAsync works just fine without the need to prompt for cameral roll permission.

Expo v27 added the requirement to ask for cameral roll permission before using them.
Why add a requirement that is not required by iOS (since it works on v26)?

2 Likes
#2

i have the same problem…
in ios and android now the camera not working… there is news about this serious Problem

 takePhoto = async () => {
        this.closeModal()
        //const { status } = await Permissions.askAsync(Permissions.CAMERA);

        const res = await Promise.all([
            Permissions.askAsync(Permissions.CAMERA),
            Permissions.askAsync(Permissions.CAMERA_ROLL)
        ]);

        console.log(res)
        if(res.some((status)=>status === 'granted')) {
            console.log('res')
            let result = await ImagePicker.launchCameraAsync({
                allowsEditing: true,
                aspect: [4, 3],
                base64: true,
                quality: 0.2
            });

            if (!result.cancelled) {
                this.setStateAsync({photo: 'data:image/png;base64,' + result.base64});
                this.setStateAsync({pathImg: result.uri});
            }
        }
    };
#3

After my Iphone updated do Ios 11.3 it stop work even on SDK 26.

I Just put to

 Permissions.askAsync(Permissions.CAMERA_ROLL)

And come back to works fine!

#4

Hey guys,

We made the change to maintain a level of consistency as iOS 10 requires it.

Cheers,

Adam

#5

Not true, I’m on iOS 11.2.6 and I’m able to use ImagePicker without CAMERA_ROLL on Expo Sdk 26.

It’s required for Android 8.0 though, but that’s not a good reason to make iOS require it too.
I think the behavior in sdk v26 is perfectly fine.

#6

Adam mentioned iOS 10, not 11. Requiring the permissions for all versions seems less error prone than relying on frequently changing OSs’ requirements, I guess :slight_smile:

#7

Oh I always thought Apple will only add more restrictions with every update, didn’t expect them to be loosening the permission level.

If this is going to be the standard from iOS 11 onwards, then it makes no sense to require the permission just for it to be compatible with an old iOS version (with diminishing market share with every passing moment).

The permission handling can be done by Expo internally (API returns with rejected promise if permission declined by user) like in SDK 26 so that developers don’t have to worry about compatibility with different versions.

Expo just need to write the test cases and make sure it only asks permission when the iOS version requires it. The significant improvement to user experience outweighs the maintenance cost.

closed #8

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.