使用第三方库react-native-camera,在ios上打开调用摄像头界面时app闪退
"react-native": "0.55.4", "react-native-camera": "^0.7.0",
在Info.plist文件中添加如下代码:
<key>NSCameraUsageDescription</key>
<string>这里的内容想写什么就写什么</string>
添加的效果:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSCameraUsageDescription</key>
<string>这里的内容想写什么就写什么</string>
</dict>
</plist>
至此,问题解决!
参考文章:https://github.com/react-native-community/react-native-camera/issues/426