4

我正在使用react-native-qr-code-scanner在我的应用程序中添加 QR 扫描仪功能。我遵循了所有的指令,并且在 android 上一切正常,但是当我在 ios 上构建我的应用程序时,应用程序无法找到该RNPermissions库,所以我按照 README 中的建议手动链接它。链接错误现在消失了,我得到了 Invali RMPermission ios.PERMISSION.CAMERA should be one of()该错误在react-native-permissions README PAGE的 github 页面和解决它的步骤中进行了描述。它说

检查您是否链接了至少一个权限处理程序。

我无法将其中描述的权限处理程序添加到 Podfile,因为它还会React(0.11.0)自动安装版本(但这不是必需的),因为我已经有了最新的反应。解决这个问题的方法是什么?

[!]

当我pod install添加后运行时

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

我明白了

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.
4

3 回答 3

6

我也遇到了这个问题ios.PERMISSION.CAMERA should be one of(),在 podfile 中使用以下命令将解决您的问题。

  pod 'RNPermissions', :path => '../node_modules/react-native-permissions'
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
于 2019-12-12T08:26:38.620 回答
2

我的解决方案是在podfile中进行以下更改:

添加 :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

添加使用相机进行二维码扫描的权限:

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

希望这可以帮助 !

于 2019-12-24T07:07:35.707 回答
0

仔细检查文件路径,它应该类似于“/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"
于 2021-06-02T17:07:39.750 回答