简体   繁体   中英

react-native-camera is not working in iOS

Hi I want to use camera in my react-native app. For this I am following this:

https://github.com/react-native-community/react-native-camera

Its is running in Android in Windows Machine, but while am coming to iOS it is not running Mac OS.

The app is installed and loading app name and then it is crashed in iPhone.

Some times its showing an error like react-native-implementation.js: cannot read property 'bindings' of null (null)

For solving this issue, manually added this module to my project like below Manual install iOS

  1. npm install react-native-camera --save

  2. In XCode, in the project navigator, right click Libraries ➜ Add Files to [your project's name]

  3. Go to node_modules ➜ react-native-camera and add RNCamera.xcodeproj

  4. Expand the RNCamera.xcodeproj ➜ Products folder In XCode, in the project navigator, select your project.

  5. Add libRNCamera.a to your project's Build Phases ➜ Link Binary With Libraries

  6. Click RNCamera.xcodeproj in the project navigator and go the Build Settings tab.

  7. Make sure 'All' is toggled on (instead of 'Basic').

  8. In the Search Paths section, look for Header Search Paths and make sure it contains both $(SRCROOT)/../../react-native/React and $(SRCROOT)/../../../React - mark both as recursive.

My System configuration:

I am using the PyCharm Editor for implementing my react-native projects.

npm: 6.1.0

react-native-cli: 2.0.1

react-native: 0.56.0

macOS HighSierra 10.13.5

Xcode 9.4.1.

This Bug seems related to upgrading to react-native@0.56.0.
Unfortunately there is no general solution yet. It will probably be fixed in react-native@0.56.1.
You should follow https://github.com/facebook/react-native/issues/20074 and linked issues.
Meanwhile try to use an older version of react-native like 0.55.4.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM