首页 > 解决方案 > React-native 相机胶卷链接问题

问题描述

我正在尝试将库添加到我的项目@react-native-community/cameraroll。但它没有得到链接,并且在 Xcode 中构建总是失败,甚至没有显示错误。

我的座右铭是使用 react-native 将图像保存到 iOS 和 android 中的 cameraroll

我正在使用 React-native 版本 0.60

标签: iosxcodereact-nativeandroid-studio

解决方案


遵循以下步骤:

react-native unlink  @react-native-community/cameraroll
npm uninstall @react-native-community/cameraroll
cd ios/ && pod install && cd ..
rm -rf node_modules
rm -rf package-lock.json
npm install
npm install @react-native-community/cameraroll --save
cd ios/ && pod install && cd ..
react-native run-ios

如果由于任何原因这不起作用,只需卸载 @react-native-community/cameraroll 库,然后尝试使用 react-native run-ios app 命令运行并检查是否有效,然后将以下内容添加到您的 package.json 文件中的依赖项:

"@react-native-community/cameraroll": "^1.2.1"

它为我工作。


推荐阅读