React-native: CameraRoll / Cannot read property 'getPhotos' of undefined

Created on 6 Nov 2015  路  8Comments  路  Source: facebook/react-native

Hi there,

I wanted to use the CameraRoll. But it does not work.

   CameraRoll.getPhotos({first: 2,}, 
            function(data) { // richtiger callback
            console.log(data);
        }, function(err) { // error callback
            console.log(err);
        });

this is my header:

'use strict';

var React = require('react-native');
var {
  AppRegistry,
  View,
  Animated,
  StatusBarIOS,
  CameraRoll,
  TouchableOpacity,
  TouchableWithoutFeedback,
  Text,
  StyleSheet,
  NavigatorIOS
} = React;

are there any more requirements I possibly missed?

"react-native": "^0.13.2",

Locked

Most helpful comment

More info on linking the lib:
You have to import node_modules/react-native/Libraries/CameraRoll/RCTCameraRoll.xcodeproj

All 8 comments

For Android: #3901
For iOS: You need to link the libraries in XCode.

@klausbreyer

https://thebhwgroup.com/blog/accessing-iphone-camera-roll-images-react-native

I followed this tutorial on how to use Camera Roll. I've only tried it on iOS. I'm not certain that Android works the same

@whokilledtheelectricmonk, @JakeRawr thanks for answering!

More info on linking the lib:
You have to import node_modules/react-native/Libraries/CameraRoll/RCTCameraRoll.xcodeproj

For those running into problems after correctly linking the libRCTCameraRoll.a library, don't forget to correctly set NSPhotoLibraryUsageDescription in Info.plist.

I followed the instructions here:
https://facebook.github.io/react-native/docs/linking-libraries-ios.html

If I add libRCTCameraRoll.a it puts out an error saying that

Unable to run command 'Libtool libRCTCameraRoll.a' - this target might include its own product.

Can anyone point out what I'm missing?

Hi @paulsoh did you find the solution to this?

Was this page helpful?
0 / 5 - 0 ratings