Console.error: no permission handler detected.(React Native)
Asked Answered
C

18

54

I am coding a simple react native app and am getting a console error when I run the app. It says that there is no permission handler detected and tells me to go through some steps. But I do not know how to do these steps, and if they don't work, I don't know how to solve the problem.

Here is the error:

enter image description here

Here is the podfile:

platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

def add_flipper_pods!(versions = {})
  versions['Flipper'] ||= '~> 0.33.1'
  versions['DoubleConversion'] ||= '1.1.7'
  versions['Flipper-Folly'] ||= '~> 2.1'
  versions['Flipper-Glog'] ||= '0.3.6'
  versions['Flipper-PeerTalk'] ||= '~> 0.0.4'
  versions['Flipper-RSocket'] ||= '~> 1.0'

  pod 'FlipperKit', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FlipperKitLayoutPlugin', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/SKIOSNetworkPlugin', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FlipperKitUserDefaultsPlugin', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FlipperKitReactPlugin', versions['Flipper'], :configuration => 'Debug'

  # List all transitive dependencies for FlipperKit pods
  # to avoid them being linked in Release builds
  pod 'Flipper', versions['Flipper'], :configuration => 'Debug'
  pod 'Flipper-DoubleConversion', versions['DoubleConversion'], :configuration => 'Debug'
  pod 'Flipper-Folly', versions['Flipper-Folly'], :configuration => 'Debug'
  pod 'Flipper-Glog', versions['Flipper-Glog'], :configuration => 'Debug'
  pod 'Flipper-PeerTalk', versions['Flipper-PeerTalk'], :configuration => 'Debug'
  pod 'Flipper-RSocket', versions['Flipper-RSocket'], :configuration => 'Debug'
  pod 'FlipperKit/Core', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/CppBridge', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FBCxxFollyDynamicConvert', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FBDefines', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FKPortForwarding', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FlipperKitHighlightOverlay', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FlipperKitLayoutTextSearchable', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FlipperKitNetworkPlugin', versions['Flipper'], :configuration => 'Debug'
end

# Post Install processing for Flipper
def flipper_post_install(installer)
  installer.pods_project.targets.each do |target|
    if target.name == 'YogaKit'
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '4.1'
      end
    end
  end
end

target 'LocalMainStreet' do
  # Pods for LocalMainStreet
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga', :modular_headers => true

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'

  target 'LocalMainStreetTests' do
    inherit! :complete
    # Pods for testing
  end

  use_native_modules!

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  add_flipper_pods!
  post_install do |installer|
    flipper_post_install(installer)
  end
end

target 'LocalMainStreet-tvOS' do
  # Pods for LocalMainStreet-tvOS

  target 'LocalMainStreet-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

Please help. Thanks.

Cribbage answered 24/5, 2020 at 0:12 Comment(0)
C
21

You just have to install RN Permissions and make changes to the podfile and info.plist. Depending on what you need the permissions for, you get the pods. If you're not sure, do them all. You can find the code at https://www.npmjs.com/package/react-native-permissions. There are also some other things you may have to do-those I didn't talk about but are in the npm documentation in the link.

Thanks to @Raghav Herugu for helping me solve the problem

Cribbage answered 24/5, 2020 at 21:26 Comment(1)
I have faced the same problem in my project. I have missed doing pod install after updating the pod file with permissions.Hannahhannan
C
18

Added these in podFile

  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways/Permission-LocationAlways.podspec"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse/Permission-LocationWhenInUse.podspec"

Then run pod install For me this worked.

Coast answered 10/8, 2021 at 7:24 Comment(2)
Could you please explain why that works?Abdomen
simply its a path correction @PhilippLehmannCoast
P
16

If you are using use_frameworks! (for example for firebase app)

add the following to convert all permission pods into static libraries, according to the docs.

pre_install do |installer|
  Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}

  installer.pod_targets.each do |pod|
    if pod.name.eql?('RNPermissions') || pod.name.start_with?('Permission-')
      def pod.build_type;
        Pod::BuildType.static_library
      end
    end
  end
end

Add necessary permissions for your app after use_react_native!(...):

use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => false,
    :fabric_enabled => flags[:fabric_enabled],
  )

  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-LocationAccuracy', :path => "#{permissions_path}/LocationAccuracy"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse"

Clean your project in XCode => Product => Clean Project Clean Derived data:

rm -rf ~/Library/Developer/Xcode/DerivedData

Note: Close the IOS Simulator

Also you can go to ios folder and delete Podfile.lock and Pods folder.

Install the pods: npx pod-install or cd ios && pod install

Try to run your app.

yarn ios or npm run ios

Phonolite answered 23/12, 2022 at 15:49 Comment(3)
This is really important, and I'm surprised more people haven't pointed this out. If you're using Firebase, you probably need to use static linkage as well, so this may be a must.Lawford
this answer fixed my project issueLarghetto
After adding these lines in the podfile I started to receive the following error: "10 duplicate symbols for architecture arm64"Billy
C
5

They have mentioned about this issue in the documentation and also suggested a fix for the same and it works. Clearing the Xcode cache worked for me :)

Solution:

If you see a No permission handler detected error: Make sure that you have at least one permission handler set up. In some cases the Xcode cache needs to be cleared (Xcode -> Product -> Clean Build Folder)

Consignor answered 30/7, 2021 at 11:5 Comment(0)
H
4

At the moment, your Podfile is not configured to handle permissions. In your Podfile under your target, add the relevant lines of code for the permissions you are requesting:

target 'LocalMainStreet' do

  # react-native-permissions permission handlers
  permissions_path = '../node_modules/react-native-permissions/ios'

  pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency.podspec"
  pod 'Permission-BluetoothPeripheral', :path => "#{permissions_path}/BluetoothPeripheral.podspec"
  pod 'Permission-Calendars', :path => "#{permissions_path}/Calendars.podspec"
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
  pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts.podspec"
  pod 'Permission-FaceID', :path => "#{permissions_path}/FaceID.podspec"
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec"
  pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary.podspec"
  pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone.podspec"
  pod 'Permission-Motion', :path => "#{permissions_path}/Motion.podspec"
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications.podspec"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec"
  pod 'Permission-Reminders', :path => "#{permissions_path}/Reminders.podspec"
  pod 'Permission-Siri', :path => "#{permissions_path}/Siri.podspec"
  pod 'Permission-SpeechRecognition', :path => "#{permissions_path}/SpeechRecognition.podspec"
  pod 'Permission-StoreKit', :path => "#{permissions_path}/StoreKit.podspec"

end

You can read more about it in the react-native-permissions repo.

Handcart answered 19/9, 2020 at 1:31 Comment(1)
The paths have changed. My camera podspec was at ../node_modules/react-native-permissions/ios/Camera/Permission-Camera.podspecHokku
C
4

The path changed. Now its ok. See below:

# permissions 
  pod 'Permission-BluetoothPeripheral', :path => "#{permissions_path}/BluetoothPeripheral/Permission-BluetoothPeripheral.podspec"
  pod 'Permission-Calendars', :path => "#{permissions_path}/Calendars/Permission-Calendars.podspec"
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera/Permission-Camera.podspec"
  pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts/Permission-Contacts.podspec"
  pod 'Permission-FaceID', :path => "#{permissions_path}/FaceID/Permission-FaceID.podspec"
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways/Permission-LocationAlways.podspec"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse/Permission-LocationWhenInUse.podspec"
  pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary/Permission-MediaLibrary.podspec"
  pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone/Permission-Microphone.podspec"
  pod 'Permission-Motion', :path => "#{permissions_path}/Motion/Permission-Motion.podspec"
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications/Permission-Notifications.podspec"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary/Permission-PhotoLibrary.podspec"
  pod 'Permission-Reminders', :path => "#{permissions_path}/Reminders/Permission-Reminders.podspec"
  pod 'Permission-Siri', :path => "#{permissions_path}/Siri/Permission-Siri.podspec"
Countless answered 20/6, 2021 at 23:39 Comment(1)
Did you change something for it to be "ok"? Perhaps explain what I'm looking at below?Dragonhead
B
4

iOS

By default no permission handler is installed. Update your Podfile by choosing the ones you want to check or request, then run pod install.

target 'YourAwesomeProject' do

  # …

  permissions_path = '../node_modules/react-native-permissions/ios'

  pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency"
  pod 'Permission-BluetoothPeripheral', :path => "#{permissions_path}/BluetoothPeripheral"
  pod 'Permission-Calendars', :path => "#{permissions_path}/Calendars"
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
  pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts"
  pod 'Permission-FaceID', :path => "#{permissions_path}/FaceID"
  pod 'Permission-LocationAccuracy', :path => "#{permissions_path}/LocationAccuracy"
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse"
  pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary"
  pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone"
  pod 'Permission-Motion', :path => "#{permissions_path}/Motion"
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
  pod 'Permission-PhotoLibraryAddOnly', :path => "#{permissions_path}/PhotoLibraryAddOnly"
  pod 'Permission-Reminders', :path => "#{permissions_path}/Reminders"
  pod 'Permission-Siri', :path => "#{permissions_path}/Siri"
  pod 'Permission-SpeechRecognition', :path => "#{permissions_path}/SpeechRecognition"
  pod 'Permission-StoreKit', :path => "#{permissions_path}/StoreKit"

end
Backstretch answered 2/8, 2021 at 6:35 Comment(0)
T
2

I was facing this issue and realized that regardless all configurations I was missing to "setup" the permissions.

Based on that, if you have done everything mentioned on other answers and it still didn't work, make sure you ran npx react-native setup-ios-permissions followed by pod install.

Trapani answered 5/5, 2023 at 5:59 Comment(1)
I ran that command and cleaned the project including pod install. Still get the error.Irradiation
D
1

I had the same issue because I forgot to do:

npx pod-install
//or
cd ios
pod-install
Deist answered 23/4, 2021 at 14:11 Comment(0)
I
1

In addition to @Vaibhav Herugu's answer::

  • Ensure the react-native-permissions package is installed. For Podfile tweaks? follow the instruction guide here:: https://www.npmjs.com/package/react-native-permissions

  • Uninstall the app on your device

  • You can delete the Xcode DerivedData folder directly from the terminal: rm -rf ~/Library/Developer/Xcode/DerivedData

  • Rebuild your app and smile :) (Hopefully)

Incandescence answered 31/8, 2022 at 23:7 Comment(1)
I missed critical information for configuring permissions. If you find yourself with these errors, double-check the doc.Irradiation
O
1

at very first do close your simulator then run npx react-native setup-ios-permissions then cd ios then pod install then cd .. and run your project npx react-native run-ios

Orinasal answered 19/7, 2023 at 19:41 Comment(0)
C
1

Instead of configuring each Pod file,

Install react-native-permissions by running a command

npm i react-native-permissions

or

yarn add react-native-permissions

This will install the react-native-permissions package. Then in ios/Podfile

use_react_native!(
)

##....

pod 'RNPermissions', :path => '../node_modules/react-native-permissions'

##....

This will add the required Pods to the iOS project.

Then run

cd ios
pod install
Corrode answered 27/10, 2023 at 16:31 Comment(0)
M
1

I also have same issue I got the solution.

you just need to update that package. Previously i'm using 3.2.0 version of that package and I continuously face that issue.

with the help of @Developerusman I resolve this issue while updating Package to "react-native-permissions": "^3.10.1",

also you can check this out GitHub Issues

First thing you have to paste this code in podfile:

permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways/Permission-LocationAlways.podspec"
pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse/Permission-LocationWhenInUse.podspec"
pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts"
pod 'Permission-LocationAccuracy', :path => "#{permissions_path}/LocationAccuracy"
pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary"
pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"
pod 'Permission-PhotoLibraryAddOnly', :path => "#{permissions_path}/PhotoLibraryAddOnly"

I hope It can help you.

Muumuu answered 8/1 at 6:54 Comment(0)
S
0

I was having the same issue with React Native 0.63.2.

The Solution was

1 - to update my cocopods version with

sudo gem install cocoapods --pre

2 - remove the following code from my pod file

pre_install do |installer|
  installer.pod_targets.each do |pod|
    if pod.name.eql?('RNPermissions') || pod.name.start_with?('Permission-')
      def pod.build_type;
        # Uncomment one line depending on your CocoaPods version
        Pod::BuildType.static_library # >= 1.9
        #Pod::Target::BuildType.static_library # < 1.9
      end
    end
  end
end

After that, I did a pod install and everything was working again.

Shitty answered 30/7, 2020 at 8:26 Comment(1)
This is correct as a work around when you use the user_frameworks! directive, as you can se in the documentation diff.Amadaamadas
A
0

In my case, delete the build folder and rebuild then everything is go success.

Autonomic answered 23/8, 2022 at 11:24 Comment(0)
R
0

May 2023

Upgrading to the latest React Native version (0.71.8) fixed this for me.

Recessional answered 19/5, 2023 at 23:12 Comment(1)
Then your issue was probably unrelated because I'm running 0.72.3 and get this error.Irradiation
M
0

I add the geolocation service and update the info.plist file after that, I have to get the same problem that you mentioned in the image

Steps that I have followed through the react-native-permission document that's work for me

I add this code to the package.json file. In the reactNativePermissionsIOS object, you can add those things you want to access mentioned in the document

"reactNativePermissionsIOS": [
    "Camera",
    "PhotoLibrary",
    "LocationWhenInUse"
  ],

and then add in info.plist that you want to access

<key>NSPhotoLibraryUsageDescription</key>
    <string>Talemi marakiz needs to access the image gallery</string>
    <key>NSCameraUsageDescription</key>
    <string>Talemi marakiz need to access camera</string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>Talemi marakiz needs to access your location</string>

I read the react-native-permission document for ios React Native Permission for ios

In the documentation, you need something to be noted. after setup all the things you must need to run this npx react-native setup-ios-permissions in your terminal

I set up all those things but forgot to run this specific code so I get an error. In my case after run this npx react-native setup-ios-permissions error resolve

Meadors answered 22/5, 2023 at 10:25 Comment(1)
I still can't get it running. I have added following handler in the Podfile permissions_path = '../node_modules/react-native-permissions/ios' pod 'Permission-Camera', :path => "#{permissions_path}/Notifications/Permission-Camera.podspec" ` I get following error. duplicate symbol '_OBJC_IVAR_$_RNPermissionHandlerCamera._reject' followed by 4 duplicate symbols for architecture arm64.Megganmeggi
M
0

I am facing same issue in react-native-0.72.0

Resolve steps

Step 1 :- install "react-native-permissions": "3.0.4" version

Step 2 :- Add belove code in your pod file inside target 'Your app name' do section

permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-Camera', :path => "#{permissions_path}/Camera"

If below code exists in your package.json ! just delete it No need for extra configuration !

 "resolutions": {
    "react-native-permissions": "^3.8.4"
  },
  
"overrides": {
    "react-native-qrcode-scanner": {
      "react-native-permissions": "^3.8.4"
  }
Maura answered 21/6 at 5:39 Comment(1)
I took 2 days to find this solutionsMaura

© 2022 - 2024 — McMap. All rights reserved.