Expo-Media-Library "12.1.2" IOS 15.2

Could someone help me, I’m on IOS 15.2 (simulator) and when requesting the MEDIA_LIBRARY permission it returns [granted] however when I use expo-media-library it returns the following error:

Error: MEDIA_LIBRARY permission is required to do this operation.

“expo-media-library”: “^12.1.2”,
“expo-permissions”: “~10.0.0”,

Permission routine:

const { status } = await Permissions.askAsync(Permissions.MEDIA_LIBRARY);

Hey @cerivera, the Permissions module has been removed in favor of each module having it’s own permission methods. Please use either the hook or get/request methods found here MediaLibrary - Expo Documentation

1 Like

Thanks for answering, I have tried with
onst status = await MediaLibrary.requestPermissionsAsync();
but it sends me this message all the time [Error: Permissions module not found. Are you sure that Expo modules are properly linked?]

Expo 41
“expo-media-library”: “^12.1.2”,

LOG Estado—> granted
WARN Possible Unhandled Promise Rejection (id: 3):
Error: MEDIA_LIBRARY permission is required to do this operation.

My code is:
const { status } = await MediaLibrary.requestPermissionsAsync();
and response:
Error: Permissions module not found. Are you sure that Expo modules are properly linked?

“expo-media-library”: “^12.1.2”,
“react-native”: “0.64.1”,
“expo”: “^41.0.1”,
“react-native-unimodules”: “^0.13.3”,

app.json
“expo”: {
“plugins”: [
[
“expo-media-library”,
{
“photosPermission”: “Allow $(PRODUCT_NAME) to access your photos.”,
“savePhotosPermission”: “Allow $(PRODUCT_NAME) to save photos.”,
“isAccessMediaLocationEnabled”: true
}
]
],

xcode 13.2.1

Privacy - Photo Library Additions Usage Description
Privacy - Photo Library Usage Description
Privacy - Media Library Usage Description


Please Help, i don’t know anymore solutions.
Thank you very much for your help.

:slightly_smiling_face:

If you run expo doctor you will see that you should be using an older version of expo-media-library with Expo SDK 41.

$ expo doctor
Some dependencies are incompatible with the installed expo package version:
 - expo-media-library - expected version: ~12.0.2 - actual version installed: 12.1.2
Your project may not work correctly until you install the correct versions of the packages.
To install the correct versions of these packages, please run: expo doctor --fix-dependencies,
or install individual packages by running expo install [package-name ...]

Try fixing this (e.g. by running expo doctor --fix-dependencies) and see if it fixes your problem.

So you’ve ejected to the Bare workflow?

I am not 100% sure how config plugins work if you’ve ejected. Maybe running expo prebuild --clean will help, but I’m not really sure. If you want to work in the Bare workflow, make sure you have your android and ios directories committed to Git before you try something like expo prebuild --clean in case you need to revert.

EDIT: expo prebuild --clean does seem to be the way to regenerate the native files, if that’s what you want to do.

I think you should try running expo doctor --fix-dependencies anyway, regardless of whether you’re on the Managed or Bare workflow.

1 Like

You are amazing :sunglasses:, I managed to solve the problem with
[expo doctor --fix-dependencies] without having to run [expo prebuild --clean] since this would cause the IOS and ANDROID folders to be deleted, which is not good for my project, since I have created native modules [JAVA AND SWIFT].

The problem was had on IOS but now it works on both platforms.

I greatly appreciate the help given.

IMPORTANT NOTE: in case someone, update to version expo 41.0.1 and use [expo doctor --fix-dependencies] library [expo-camera: 11.0.2] has a conflict with library [expo-contacts:9.1.2] causing the following error [expo-contacts error: package org.jetbrains.annotations does not exist] for now leave the version [expo-camera: 9.1.0] as the error is possibly fixed in the following versions of [expo 42, 43 , 44]

Another error [ANDROID] that was generated as a result of the update was:
[FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:processDebugResources’.

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Android resource linking failed
//android/app/build/intermediates/packaged_manifests/debug/AndroidManifest.xml:184: AAPT: error: resource style/DeviceCredentialHandlerTheme (aka com.cer:style/DeviceCredentialHandlerTheme) not found.]

The solution to the error is found in the following link:
[Solution Here]

I copy the solution in case the link is lost:

[YouAPP name/android/app/src/main/AndroidManifest.xml

check the arrival name

chage with this
android:theme=“@style/DeviceCredentialHandlerTheme”

and check the app theme name in

YouAPP name/android/app/src/main/res/values/styles.xml

change the name to error theme name its works for me try to run yarn android] Author: By Stone Hammer Danny Reichel at May 04 2021
1 Like

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