"No permission handler detected." error using react-native-permissions with Expo and dev-client build

Viewed 355

I am trying to get react-native-permissions in my dev-client build of Expo to run. The build succeeds, but when I start the app, I am getting a relatively generic "No permission handler detected." error.

Research suggest that adding permissions to the ios/Podfile and making sure that ios/<appname>/Info.plist entries need to exist.

The app works without react-native-permissions, but I want to use the package to check if permissions are set and direct the user towards settings, if not.

ios/Podfile

  pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone"
  pod 'Permission-SpeechRecognition', :path => "#{permissions_path}/SpeechRecognition"

ios/< appname >/Info.plist (relevant entries)

    <key>NSMicrophoneUsageDescription</key>
    <string>CUSTOM: Allow to access the microphone</string>
    <key>NSSpeechRecognitionUsageDescription</key>
    <string>CUSTOM: Allow to securely recognize user speech</string>

app.config.js (expo)

...
   "plugins": [
            "@react-native-firebase/app",
            "@react-native-firebase/perf",
            "@react-native-firebase/crashlytics",
            "@react-native-google-signin/google-signin",
            ["react-native-fbsdk-next",
                {
                    "appID": "xxx",
                    "clientToken": "xxx",
                    "displayName": "xxx",
                    "advertiserIDCollectionEnabled": false,
                    "autoLogAppEventsEnabled": false,
                    "isAutoInitEnabled": true
                }
            ],
            [
                "@react-native-voice/voice",
                {
                    "microphonePermission": "CUSTOM: Allow access the microphone",
                    "speechRecognitionPermission": "CUSTOM: to securely recognize user speech"
                }
            ]
        ]

Workflow

expo prebuild --clean

cd ios

# modify `Podfile` and add below two lines
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone"
pod 'Permission-SpeechRecognition', :path => "#{permissions_path}/SpeechRecognition"

pod install

cd ..
eas build --platform ios --profile development --local

enter image description here

1 Answers

I was also having the same issue. Then I read the error message that you shared contained the solution to the problem. The following steps worked for me:

  • Check that you link at least one permission handler in your Podfile
  • Uninstall this app, delete your xcode DerivedData folder and rebuild it.

I did't need to do the third step.

Related