react-native-vision-camera integration with expo EAS Fails for IOS

I am trying to add React native vision camera library with expo, I am currently using EAS for builds. I added react-native-vision-camera to package,json and I am requesting the required permissions from the user using the same library… The build works fine on android after running “npx expo prebuild” and creating a development build build however It isn’t working for IOS and it displays the following message after creating the build and trying to run it locally:

“No permission handler detected.
• Check that you added at least one permission handler in your package.json reactNativePermissionsIOS config.
• Uninstall this app, reinstall your Pods, delete your Xcode DerivedData folder and rebuild it.”

I tried updating info.plist file to add all permissions and rebuilt the project but I am still getting same error message

please let me know the cause of this error as well as what steps can be taken to solve it

Thanks.

Hi @nuraqas

You do not need to run npx expo prebuild. If you do it effectively switches you to the bare workflow.

I know the react-native-vision-camera docs tell you to run it, but it is not necessary for you to run it. If you do not run it then it will be run for you automatically by the build servers.

If you have not made any changes to the android and ios directories, I suggest you delete them to switch back to the managed workflow. Then try building again and see if that sorts out the problem.

Thanks for your reply!

building with managed flow without expo pre-build worked for staging version and, however I am receiving the following error (“no permissions handler detected”) for development environment:

any idea why this is happening and how to solve it?

Thanks

1 Like

hmmm… not sure.

What are you using for the permissions?

I assume you have something like this in your plugins section in app.json?

  "plugins": [
    [
      "react-native-vision-camera",
      {
        "cameraPermissionText": "$(PRODUCT_NAME) needs access to your Camera.",

        // optionally, if you want to record audio:
        "enableMicrophonePermission": true,
        "microphonePermissionText": "$(PRODUCT_NAME) needs access to your Microphone."
      }
    ]
  ]

And then in the code you’re calling one or both of these?

const cameraPermission = await Camera.getCameraPermissionStatus()
const microphonePermission = await Camera.getMicrophonePermissionStatus()

Do you have anything else related to permissions in your dependencies in package.json?

After some more poking around it seems the “Check that you added at least one permission handler in your package.json” message is coming from GitHub - zoontek/react-native-permissions: An unified permissions API for React Native on iOS, Android and Windows.

I’ve only had a brief look, but it might conflict with the way Expo and its config plugins do things. You might be able to get it to work by calling npx react-native setup-ios-permissions in a build hook or something like that.

Otherwise, you will need to run npx expo prebuild and then continue with the Bare workflow. Or else, replace react-native-permissions with something else.

3 Likes

This was the answer for me. I spent weeks trying to figure out what was going on, having expo configs living side-by-side with react-native-permissions. I didn’t realize that they were somehow in conflict and react-native-permissions was not necessary. I simply did yarn remove react-native-permissions, did a new build and it started working in my iOS simulator.

1 Like