使用CameraRoll保存图片时报错cannot read property savetocameraroll

在使用react-native-image-zoom-viewer保存图片时,报错cannot read property ‘savetocameraroll’。
查找之后发现react-native-image-zoom-viewe保存图片使用的是CameraRollapi。所以我们需要在xcode中添加静态库依赖。
具体操作如下:

  1. 首先打开你的项目目录/node_modules/react-native/Libraries/CameraRoll/ 找到RCTCameraRoll.xcodeproj这个文件。
    64a9b9e25413d805e521e2fff7ccf057.png
  2. 然后把它拖到xcode的Libraries目录下。
    3b128eea5723112f6ddae537ce7a6f5a.png
  3. 然后点击项目标签在General标签中找到Linked Frameworks and Libraries 点击下边的**+**号把libRCTCameraRoll.a加进来
    12d2173d1acc75db86ceaa91cc157db6.png

a1a852cade9539bf2acb1469d4747fda.png

然后再返回你的项目中保存图片应该就不会错了。