Undefined is not an object (rating "RCTCameraRollManager.getPhotos")

I want to use CameraRoll to get a snapshot but broken by a red screen.

So, I tried the following:

//print: undefined console.log(RCTCameraRollManager); 

red screen

+8
react-native
source share
2 answers

Please check if RCTCameraRoll has been added to your library. If not, you should link the library to node_module/react-native/Libraries/CameraRoll

There is a lot of guidance on linking libraries to the-native response in interactive documents https://facebook.imtqy.com/react-native/docs/linking-libraries-ios.html#content

+15
source share

As an android developer, I tried my best to use a camera handle with a reaction. I could find him in the following place: -

 node_module/react-native/Libraries/CameraRoll 

And when linking the library using the "CameraRoll native reaction", I came across the following error: -

 npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/react-native-cameraroll 

Therefore, we need to manually link it as follows:

open your Xcode.Then from node_module / react-native / Libraries / CameraRoll drag RCTCameraRoll.xcodeproj to the left side of the Libraries folder. Now go to Project - general - "Related Structures and Libraries" add (+) a folder called libRCTCameraRoll.a.

Reinstall and it works.

+1
source share

All Articles