anekix
anekix

Reputation: 2563

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.

Upvotes: 5

Views: 18949

Answers (3)

isFibonacci
isFibonacci

Reputation: 41

Double-check the file path, it should be like "/Camera/Permission-Camera.podspec".

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

Upvotes: 1

Redmen Ishab
Redmen Ishab

Reputation: 2339

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 !

Upvotes: 2

Tommy Leong
Tommy Leong

Reputation: 3030

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"

Upvotes: 8

Related Questions