Linking the CameraRoll API to the iOS project - gorjanz/rn-treasure-hunt GitHub Wiki

Linking CameraRoll API to the iOS project

Almost all of the needed files (project files and library files, headers etc...) come already linked in the iOS and Android project. But for the CameraRoll API, for the iOS platform, the files for some reason, even though they are supposed to be there, are not. So if you try to use the CameraRoll API in your app, you get a runtime error, because the needed functionality is not there.

The problem on iOS is that, although, in Build Settings / Header Search Paths there is an entry in the form of: $(SRCROOT)/../node_modules/react-native/React which is marked recursive, the RCTCameraRoll.xcodeproj is not linked with your app, which consequently leads to libRCTCameraRoll.a not being in the Linked Frameworks and Libraries section.

The solution is to go to Build Phases in the xcodeproject file, and by clicking on the + icon, first to link the node_modules/react-native/Libraries/CameraRoll.xcodeproject file, and then add the libRCTCameraRoll.a file also.

After connecting the files manually, everything behaves as expected.