react native中的CameraRoll使用时,TypeError: Cannot read property 'getPhotos' of undefined错误

CameraRoll是RN的静态类,使用getPhotos方法时,如果xcode没有配置依赖包,则会报错。

报错TypeError: Cannot read property 'getPhotos' of undefined错误。



问题解决如下:

1.在xcode中手动导入RCTCameraRoll.xcodeproj

右键“Library”,选择“Add ....”   RCTCameraRoll.xcodeproj的路径为

"/Users/xxxx/demo/node_modules/react-native/Libraries/CameraRoll"


2.在Link Binary With Libraries 菜单中加入libRCTVideo.a到工程中,直接拖过去。



3.添加Info.plist的读取相册权限 即可!


猜你喜欢

转载自blog.csdn.net/ky1in93/article/details/80822777
今日推荐