Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inavlid react Native permission ios.PERMISSION.CAMERA

I am using react-native-qr-code-scanner to add QR scanner functionality in my app. I followed all the instaruction ther & everything works fine on android but when i build my app on ios app is not able to find the RNPermissions library so i manually linked it as suggested on it README. Linked error is now gone and i am getting Invali RMPermission ios.PERMISSION.CAMERA should be one of(). The error is described on the github page of react-native-permissions README PAGE & steps to solve it. it says

Check that you linked at least one permission handler.

I cannot add permission handler as described there to Podfile as it aslo installs the React(0.11.0) verison automatically (but this is not required ) as i already have newest react. what is the way to solve this?

[!]

When i run pod install after adding

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

i get

Unable to find a specification for `RNPermissions` depended upon by `Permission-Camera`

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.
like image 496
anekix Avatar asked Mar 03 '23 03:03

anekix


2 Answers

I've gotten the issue ios.PERMISSION.CAMERA should be one of() as well, use the following command in podfile will solve your issue.

  pod 'RNPermissions', :path => '../node_modules/react-native-permissions'
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
like image 160
TommyLeong Avatar answered Mar 16 '23 18:03

TommyLeong


My solution was to do the following changes in podfile :

add :modular_header => false

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

add permissions for usage of camera for qrcode scanning:

  pod 'Permission-Camera', :path => "../node_modules/react-native-permissions/ios/Camera.podspec"

Hope this helps !

like image 33
ishab acharya Avatar answered Mar 16 '23 17:03

ishab acharya