Home / IOS Development / React native firebase ml kit face detector works on Android but not iOS

React native firebase ml kit face detector works on Android but not iOS



I’m trying to implement rnfirebase mlKit vision, but it only works on Android, not iOS. I take a picture with react-native-camera and use data.uri to transfer it to ml-vision. I am running react native version 0.63.3. I have followed the installation steps here, and here I have tried everything I can find online, but it is not much.

my code is as follows but all i get in console.log (faces =, faces) is an empty array so forEach loop does not run

 const faces = await vision().faceDetectorProcessImage(data.uri);
      console.log('faces=", faces);

      faces.forEach(face => {
        console.log("Head rotation on Y axis: ', face.headEulerAngleY);
        console.log('Head rotation on Z axis: ', face.headEulerAngleZ);

        console.log('Left eye open probability: ', face.leftEyeOpenProbability);
        console.log('Right eye open probability: ', face.rightEyeOpenProbability);
        console.log('Smiling probability: ', face.smilingProbability);

        face.faceContours.forEach(contour => {
          if (contour.type === VisionFaceContourType.FACE) {
            console.log('Face outline points: ', contour.points);
          }
        });
      });

my package.json

"dependencies": {
    "@material-ui/icons": "^4.9.1
", "@react-native-community/async-storage": "^1.12.0", "@react-native-community/cameraroll": "^1.8.1", "@react-native-community/image-editor": "^2.3.0", "@react-native-community/masked-view": "^0.1.10", "@react-native-community/netinfo": "^5.9.7", "@react-native-community/picker": "^1.6.6", "@react-native-firebase/analytics": "^7.6.7", "@react-native-firebase/app": "^8.4.5", "@react-native-firebase/database": "^7.5.11", "@react-native-firebase/messaging": "^7.9.0", "@react-native-firebase/ml-vision": "^7.4.8",

podfilen min

$FirebaseSDKVersion = '6.29.0'
$RNFirebaseAsStaticFramework = true

platform :ios, '10.0'

target 'idSxanner' do

config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])


  pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'

  target 'idSxannerTests' do
    inherit! :complete
    # Pods for testing
  end


  # 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 'idSxanner-tvOS' do
  # Pods for idSxanner-tvOS

  target 'idSxanner-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end


Source link