【问题标题】:React-Native-Camera - Cannot read property 'Aspect' of UndefinedReact-Native-Camera - 无法读取未定义的属性“方面”
【发布时间】:2017-01-14 00:11:13
【问题描述】:

所以我在尝试运行 React Native Camera https://github.com/lwansbrough/react-native-camera 时遇到未定义错误的无法读取属性“Aspect”

我知道这个 GitHub 问题 https://github.com/lwansbrough/react-native-camera/issues/386

但是,我基本上已经尝试了其中的所有内容,但仍然出现错误。我真的必须从模拟器上的 IOS10 降级才能使用它吗?真的不想这样做。有没有人想出任何类型的解决方法?

我正在运行版本 8.1 (8B62)

我尝试手动安装、重置缓存、将代码添加到 RCTCameraManager.m 等。没有。

任何帮助将不胜感激。谢谢。

【问题讨论】:

  • 您是否尝试过在您的设备/模拟器上重建应用程序?就像删除应用程序并使用'react-native run-ios'重新安装
  • 删除应用程序?我尝试退出模拟器和终端并再次运行 react native run iOS。
  • 检查手动安装步骤 5 github.com/lwansbrough/react-native-camera
  • @BurakKarasoy 我做到了,一切看起来都很好。路径与文档中的相同。

标签: ios xcode react-native


【解决方案1】:

我也有这个问题。然后我发现我错过了文档中的两个步骤。

首先记得在 plist 文件中添加权限。

<key>NSPhotoLibraryAddUsageDescription</key>
<string>Your message to user when the camera is accessed for the first time</string>
<key>NSCameraUsageDescription</key>
<string>Your message to user when the camera is accessed for the first time</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Your message to user when the photo library is accessed for the first time</string>
<key>NSMicrophoneUsageDescription</key>

然后记得在你的 podfile 中添加依赖。

pod 'react-native-camera', :path => '../node_modules/react-native-camera'

然后运行pod install

对我来说,这两个步骤之后就可以了。如果它仍然不起作用,请检查您是否正确链接库。

希望对你有帮助。

【讨论】:

  • 我错过了将libRNCamera.a 添加到我项目的Build PhasesLink Binary With Libraries
猜你喜欢
  • 1970-01-01
  • 2019-09-27
  • 2017-10-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-03-27
  • 1970-01-01
  • 2018-10-22
相关资源
最近更新 更多