在对 GoogleVisionBarcodes 的原生相机做出反应时检测到无法在 IOS 上运行
Posted
技术标签:
【中文标题】在对 GoogleVisionBarcodes 的原生相机做出反应时检测到无法在 IOS 上运行【英文标题】:in react native camera onGoogleVisionBarcodesDetected not working on IOS 【发布时间】:2020-11-28 08:35:24 【问题描述】:在反应原生相机中,我正在使用onGoogleVisionBarcodesDetected
不会在 ios 上触发
在android上工作,但不在ios上
在安装要求中我应该在pod
文件中添加这个
pod 'react-native-camera',路径:'../node_modules/react-native-camera',子规范:[ '条形码检测器MLKit' ]
但是当我尝试安装 pod 时发生了这个错误
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
require_relative '../node_modules/react-native/scripts/react_native_pods'
platform :ios, '10.0'
target 'megatel' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
# react-native-maps dependencies
rn_maps_path = '../node_modules/react-native-maps'
pod 'react-native-google-maps', :path => rn_maps_path
pod 'GoogleMaps'
pod 'Google-Maps-iOS-Utils'
pod 'GoogleMLKit/BarcodeScanning'
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-Camera', :path => "#permissions_path/Camera.podspec"
pod 'Permission-LocationAlways', :path => "#permissions_path/LocationAlways.podspec"
pod 'Permission-PhotoLibrary', :path => "#permissions_path/PhotoLibrary.podspec"
pod 'GoogleMLKit/BarcodeScanning'
pod 'react-native-camera', path: '../node_modules/react-native-camera', subspecs: [
'BarcodeDetectorMLKit'
]
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
use_flipper!
post_install do |installer|
flipper_post_install(installer)
end
end
target 'megatel-tvOS' do
# Pods for megatel-tvOS
target 'megatel-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
“反应”:“16.9.0”, “反应原生”:“^0.63.3”, "react-native-camera": "^3.40.0",
【问题讨论】:
你找到解决办法了吗? 【参考方案1】:我昨天能够让它在 Mac 上运行。
使用onGoogleVisionBarcodesDetected
扫描速度要快得多。
我只是像你一样将片段添加到 Podfile 中:
pod 'react-native-camera', path: '../node_modules/react-native-camera', subspecs: [
'BarcodeDetectorMLKit'
]
然后运行pod update
。
使用的版本是:
CocoaPods 1.10.1
react 17.0.2
react-native 0.64.2
react-native-camera 4.1.1
GoogleMLKit 2.3.0
MLImage 1.0.0-beta1
MLKitBarcodeScanning 1.4.0
MLKitCommon 3.1.0
MLKitVision 1.3.0
【讨论】:
以上是关于在对 GoogleVisionBarcodes 的原生相机做出反应时检测到无法在 IOS 上运行的主要内容,如果未能解决你的问题,请参考以下文章
如何在对 aws dynamodb 表的查询中获取所有结果?