Media Library permission unavailable
I am using the code below in order to check / request media library permission for iOS but it says that the feature is not available both in simulators and real devices. Am I missing something?
if (Platform.OS === 'ios') {
check(PERMISSIONS.IOS.MEDIA_LIBRARY)
.then(result => {
switch (result) {
case RESULTS.UNAVAILABLE:
console.log(
'This feature is not available (on this device / in this context)',
);
break;
case RESULTS.DENIED:
console.log(
'The permission has not been requested / is denied but requestable',
);
break;
case RESULTS.GRANTED:
console.log('The permission is granted');
break;
case RESULTS.BLOCKED:
console.log(
'The permission is denied and not requestable anymore',
);
break;
}
})
.catch(error => {
console.log('media library permission error');
});
}
@jasonkang14 Please respect the issue template, and submit your Podfile.
same here. I already added media library ( same as other permissions) in Podfile though
For me it works on the real device, but is unavailable in the simulator. Have you found a solution to get it working in the simulator?
@fabyeah This is impossible: https://github.com/zoontek/react-native-permissions/blob/master/ios/MediaLibrary/RNPermissionHandlerMediaLibrary.m#L17
The only solution would be having a real emulator (the iOS simulator does not really emulate iOS, it has a lot of quirks) - see https://www.google.com/search?q=MPMediaLibrary+requestAuthorization+simulator&oq=MPMediaLibrary+requestAuthorization+simulator&aqs=chrome..69i57.3723j0j4&sourceid=chrome&ie=UTF-8
@zoontek I see, that explains it. Thought it was a bug, but then it's all good. Thanks for the info!