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
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
Share
Improve this question
asked May 28, 2022 at 5:13
Michael BrenndoerferMichael Brenndoerfer
4,1162 gold badges47 silver badges63 bronze badges
1
- 1 I found the solution here in this other question: stackoverflow./a/78650570/21819819 – J-peace Commented Feb 11 at 0:43
4 Answers
Reset to default 2I have been having the same issue for 2 days now. Turns out that react-native-permissions do not really work well with expo managed projects.
I don't know what I was doing before but since my project required just medialibrary permissions for now, the best and only alternative that worked for me was expo-media-library.
Steps that I did to make it work include:
- removing react-native-permissions: You can do so with
yarn remove react-native-permissions
- installing expo-media-library with
npx expo install expo-media-library
cd ios
then install pods again withpod install
. After do not forget tocd ..
- uninstall your app from your simulator.
- remove DerivedData from xcode: find derived data usually in
/Users/[yourUsername]/Library/Developer/xcode/DerivedData
. You can delete withrm -r
mand on your terminal - rebuild your ios app with npx expo run:ios
Please note that this worked for my expo managed project with some react-native modules such as react-native-image-picker
, however, this should not be the only solution and I will research other alternatives to this and find better solutions.
If you still face some issues after rebuilding, create a new eas build with eas build --profile development --platform ios
. For react-native-image-picker
some issues I had were solved here: issues with react-native-image-picker
react-native-permission will only work if you have ejected your expo app and have then ran prebuild for IOS. BUT if you are using EAS as your pipeline to build and create dev builds, you need to use: expo-permissions lib.
If you're using the expo config plugin rather than manually handling your podfiles, you can resolve this error by adding the permissions that you want to check to the iosPermissions
field in the react-native-permissions
expo plugin config. You have to do this even if you've already added your NS permission strings to the info.plist section of the config.
For instance, if you want to check the bluetooth permission using react-native-permissions, you would add this to your expo config:
plugins: [
[
"react-native-permissions",
{ iosPermissions: ["Bluetooth"] }
],
]
The list of available permissions matches the list of permissions mentioned in step 2 of the iOS setup in the readme, except you just add them to the expo config instead of dealing with the podfiles yourself.
This is also discussed in the readme section for expo setup.
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.