in react native camera onGoogleVisionBarcodesDetected not working on IOS

837 views Asked by At

in react native camera I am using onGoogleVisionBarcodesDetected does not triggered on IOS work on android but not ios

in the installation requirements I should add this in pod file

pod 'react-native-camera', path: '../node_modules/react-native-camera', subspecs: [ 'BarcodeDetectorMLKit' ]

but when i try to pod install this error happened

enter image description here

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

"react": "16.9.0", "react-native": "^0.63.3", "react-native-camera": "^3.40.0",

1

There are 1 answers

0
matthias On

I was able to get it to work yesterday on a Mac. Scanning is so much faster using onGoogleVisionBarcodesDetected. I just added the snipped to the Podfile like you did:

pod 'react-native-camera', path: '../node_modules/react-native-camera', subspecs: [
  'BarcodeDetectorMLKit'
]

and then ran pod update.

Used versions are:

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