AlienCoder
AlienCoder

Reputation: 101

undefined is not an object (evaluating 'RCTCameraRollManager.getPhotos')

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

So I tried following:

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

red-screen

Upvotes: 8

Views: 6112

Answers (2)

Nicks
Nicks

Reputation: 16317

Being an android developer, I was struggling to use the react-native camera roll. I was able to find it in following location :-

node_module/react-native/Libraries/CameraRoll

And while linking the library using "react-native link cameraRoll , I was facing the following error:-

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

So we need to manually link it as follows:

open your Xcode.Then from the node_module/react-native/Libraries/CameraRoll, drag the RCTCameraRoll.xcodeproj into the left side pane of Libraries folder. Now go to Project - general --"Linked frameworks and libraries" add (+) the folder named libRCTCameraRoll.a.

Re-install and it works.

Upvotes: 3

Nishanth Shankar
Nishanth Shankar

Reputation: 1976

Please check if RCTCameraRoll is added to your library. If not you must link the library to from node_module/react-native/Libraries/CameraRoll

There is great guide to linking libraries to react-native in the react-native docs https://facebook.github.io/react-native/docs/linking-libraries-ios.html#content

Upvotes: 15

Related Questions