react-native-vision-camera icon indicating copy to clipboard operation
react-native-vision-camera copied to clipboard

🐛 iOS Build fails on Xcode < 16.3 due to missing AVFoundation constants (dogHead, kCVPixelFormatType_96VersatileBayerPacked12)

Open YehorBoiar opened this issue 7 months ago • 2 comments

Prerequisites

Reproduction

https://github.com/mrousavy/react-native-vision-camera (You can reproduce this on any fresh init by simply building with an older Xcode version).

Steps to reproduce

This issue occurs on expo CI that default to macOS Sonoma and Xcode 16.0 - 16.2.

  1. Initialize a new Expo (SDK 52/53) or React Native project.
  2. Install react-native-vision-camera v5.0.8.
  3. Build the iOS app using an environment running Xcode 16.1 or 16.2 (e.g., trigger an EAS build without overriding the default image, or with overriding the default by using
"ios": {
    "image": "macos-sequoia-15.4-xcode-16.3"
}

in eas.json) 4. The Xcode build step will fail during Swift compilation.

What did you expect to happen?

Compile successfully

What actually happened?

Build crashes with multiple instances of

type 'AVMetadataObject.ObjectType' has no member X

e.g type 'AVMetadataObject.ObjectType' has no member 'dogHead'

Affected platforms

iOS (device)

Device(s) affected

N/A

VisionCamera version

5.0.8

React Native version

0.76.0 (Expo SDK 52/53)

React Native architecture

New Architecture (Fabric / bridgeless)

Features being used

  • [ ] Preview
  • [ ] Photo capture
  • [ ] Video capture
  • [x] Frame Processors (worklets)
  • [x ] Skia Frame Processors
  • [ ] Code/Barcode Scanner
  • [ ] Location metadata
  • [ ] Multi-cam
  • [ ] Depth data
  • [ ] HDR / custom dynamic range
  • [ ] Custom format / FPS / resolution

Relevant logs / stack trace

› Executing expo-constants Pods/EXConstants » [CP-User] Generate app.config for prebuilt Constants.manifest
› Compiling expo Pods/Expo » EXAppDelegatesLoader.m
› Compiling expo Pods/Expo » EXAppDefinesLoader.m
› Packaging expo Pods/Expo » libExpo.a

❌  (node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+ScannedObjectType.swift:65:51)

  63 |       } else if #available(iOS 17.0, *), type == .humanFullBody {
  64 |         self = .humanFullBody
> 65 |       } else if #available(iOS 26.0, *), type == .dogHead {
     |                                                   ^ type 'AVMetadataObject.ObjectType' has no member 'dogHead'
  66 |         self = .dogHead
  67 |       } else if #available(iOS 26.0, *), type == .catHead {
  68 |         self = .catHead

❌  (node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+ScannedObjectType.swift:67:51)

  65 |       } else if #available(iOS 26.0, *), type == .dogHead {
  66 |         self = .dogHead
> 67 |       } else if #available(iOS 26.0, *), type == .catHead {
     |                                                   ^ type 'AVMetadataObject.ObjectType' has no member 'catHead'
  68 |         self = .catHead
  69 |       } else {
  70 |         logger.error("Unknown AVMetadataObject.ObjectType: \(type.rawValue)")

❌  (node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+ScannedObjectType.swift:150:17)

  148 |     case .dogHead:
  149 |       if #available(iOS 26.0, *) {
> 150 |         return .dogHead
      |                 ^ type 'AVMetadataObject.ObjectType?' has no member 'dogHead'
  151 |       } else {
  152 |         return nil
  153 |       }

❌  (node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+ScannedObjectType.swift:158:17)

  156 |     case .catHead:
  157 |       if #available(iOS 26.0, *) {
> 158 |         return .catHead
      |                 ^ type 'AVMetadataObject.ObjectType?' has no member 'catHead'
  159 |       } else {
  160 |         return nil
  161 |       }

❌  (node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+TargetColorSpace.swift:28:17)

  26 |     case .appleLog2:
  27 |       if #available(iOS 26.0, *) {
> 28 |         return .appleLog2
     |                 ^ type 'AVCaptureColorSpace' has no member 'appleLog2'
  29 |       } else if #available(iOS 17.0, *) {
  30 |         return .appleLog
  31 |       } else {

❌  (node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+TargetStabilizationMode.swift:38:17)

  36 |     case .lowLatency:
  37 |       if #available(iOS 26.0, *) {
> 38 |         return .lowLatency
     |                 ^ type 'AVCaptureVideoStabilizationMode' has no member 'lowLatency'
  39 |       } else {
  40 |         return .standard
  41 |       }

❌  (node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+VideoCodec.swift:40:24)

  38 |       }
  39 |       if #available(iOS 26.0, *) {
> 40 |         if avCodec == .proResRAW {
     |                        ^ type 'AVVideoCodecType' has no member 'proResRAW'
  41 |           self = .proResRaw
  42 |           return
  43 |         } else if avCodec == .proResRAWHQ {

❌  (node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+VideoCodec.swift:43:31)

  41 |           self = .proResRaw
  42 |           return
> 43 |         } else if avCodec == .proResRAWHQ {
     |                               ^ type 'AVVideoCodecType' has no member 'proResRAWHQ'
  44 |           self = .proResRawHq
  45 |           return
  46 |         }

❌  (node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+VideoCodec.swift:97:15)

   95 |           withMessage: "VideoCodec \"pro-res-raw\" is only available on iOS 18.0 or higher!")
   96 |       }
>  97 |       return .proResRAW
      |               ^ type 'AVVideoCodecType' has no member 'proResRAW'
   98 |     case .proResRawHq:
   99 |       guard #available(iOS 26.0, *) else {
  100 |         throw RuntimeError.error(

❌  (node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+VideoCodec.swift:103:15)

  101 |           withMessage: "VideoCodec \"pro-res-raw-hq\" is only available on iOS 18.0 or higher!")
  102 |       }
> 103 |       return .proResRAWHQ
      |               ^ type 'AVVideoCodecType' has no member 'proResRAWHQ'
  104 |     }
  105 |   }
  106 | }
› Compiling expo-manifests Pods/EXManifests » EXManifests-dummy.m
› Compiling expo-eas-client Pods/EASClient » EASClient-dummy.m
› Packaging expo-manifests Pods/EXManifests » libEXManifests.a
› Packaging expo-eas-client Pods/EASClient » libEASClient.a
    Run script build phase '[CP-User] [Hermes] Replace Hermes for the right configuration, if needed' will be run during every build because it does not specify any outputs. To address this issue, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'hermes-engine' from project 'Pods')
    Run script build phase '[CP-User] Generate updates resources for expo-updates' will be run during every build because it does not specify any outputs. To address this issue, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'EXUpdates' from project 'Pods')
▸ ** ARCHIVE FAILED **
▸ The following build commands failed:
▸ 	SwiftCompile normal arm64 Compiling\ AV+QualityPrioritizaion.swift,\ AV+Range.swift,\ AV+RecorderFileType.swift,\ AV+ScannedObjectType.swift,\ AV+Size.swift,\ AV+TargetColorSpace.swift,\ AV+TargetStabilizationMode.swift,\ AV+TargetVideoPixelFormat.swift,\ AV+TorchMode.swift,\ AV+VideoCodec.swift,\ AV+WhiteBalanceMode.swift,\ AVCaptureConnection+deviceInput.swift,\ AVCaptureConnection+init.swift,\ AVCaptureConnection+isConnectedTo.swift,\ AVCaptureConnection+isConnectedToAudioInput.swift,\ AVCaptureConnection+isConnectedToPreview.swift,\ AVCaptureConnection+mirrorMode.swift,\ AVCaptureConnection+orientation.swift,\ AVCaptureDevice+withLock.swift,\ AVCaptureDevice.DeviceType+all.swift,\ AVCaptureDevice.Format+bitDepth.swift,\ AVCaptureDevice.Format+colorRange.swift,\ AVCaptureDevice.Format+supportedResolutionsFor.swift,\ AVCaptureDevice.Format+supportsOutput.swift,\ AVCaptureInput+isMicrophone.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+QualityPrioritizaion.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+Range.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+RecorderFileType.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+ScannedObjectType.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+Size.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+TargetColorSpace.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+TargetStabilizationMode.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+TargetVideoPixelFormat.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+TorchMode.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+VideoCodec.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+WhiteBalanceMode.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/AVFoundation/AVCaptureConnection+deviceInput.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/AVFoundation/AVCaptureConnection+init.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/AVFoundation/AVCaptureConnection+isConnectedTo.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/AVFoundation/AVCaptureConnection+isConnectedToAudioInput.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/AVFoundation/AVCaptureConnection+isConnectedToPreview.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/AVFoundation/AVCaptureConnection+mirrorMode.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/AVFoundation/AVCaptureConnection+orientation.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/AVFoundation/AVCaptureDevice+withLock.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/AVFoundation/AVCaptureDevice.DeviceType+all.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/AVFoundation/AVCaptureDevice.Format+bitDepth.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/AVFoundation/AVCaptureDevice.Format+colorRange.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/AVFoundation/AVCaptureDevice.Format+supportedResolutionsFor.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/AVFoundation/AVCaptureDevice.Format+supportsOutput.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/AVFoundation/AVCaptureInput+isMicrophone.swift (in target 'VisionCamera' from project 'Pods')
▸ 	SwiftCompile normal arm64 /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+ScannedObjectType.swift (in target 'VisionCamera' from project 'Pods')
▸ 	SwiftCompile normal arm64 /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+TargetColorSpace.swift (in target 'VisionCamera' from project 'Pods')
▸ 	SwiftCompile normal arm64 /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+TargetStabilizationMode.swift (in target 'VisionCamera' from project 'Pods')
▸ 	SwiftCompile normal arm64 /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Extensions/Converters/AV+VideoCodec.swift (in target 'VisionCamera' from project 'Pods')
▸ 	SwiftCompile normal arm64 Compiling\ Func_void_FrameDroppedReason.swift,\ Func_void_InterruptionReason.swift,\ Func_void_MediaType_FrameDroppedReason.swift,\ Func_void_PhotoFile.swift,\ Func_void_std__exception_ptr.swift,\ Func_void_std__shared_ptr_ArrayBuffer_.swift,\ Func_void_std__shared_ptr_HybridCameraDeviceFactorySpec_.swift,\ Func_void_std__shared_ptr_HybridCameraSessionConfigSpec_.swift,\ Func_void_std__shared_ptr_HybridCameraSessionSpec_.swift,\ Func_void_std__shared_ptr_HybridDepthSpec_.swift,\ Func_void_std__shared_ptr_HybridFrameSpec_.swift,\ Func_void_std__shared_ptr_HybridPhotoSpec_.swift,\ Func_void_std__shared_ptr_HybridRecorderSpec_.swift,\ Func_void_std__shared_ptr_margelo__nitro__image__HybridImageSpec_.swift,\ Func_void_std__string.swift,\ Func_void_std__string_RecordingFinishedReason.swift,\ Func_void_std__vector_std__shared_ptr_HybridCameraControllerSpec__.swift,\ Func_void_std__vector_std__shared_ptr_HybridCameraDeviceSpec__.swift,\ Func_void_std__vector_std__shared_ptr_HybridCameraExtensionSpec__.swift,\ Func_void_std__vector_std__shared_ptr_HybridScannedObjectSpec__.swift,\ HybridCameraCalibrationData.swift,\ HybridCameraCalibrationDataSpec.swift,\ HybridCameraCalibrationDataSpec_cxx.swift,\ HybridCameraController.swift,\ HybridCameraControllerSpec.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/nitrogen/generated/ios/swift/Func_void_FrameDroppedReason.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/nitrogen/generated/ios/swift/Func_void_InterruptionReason.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/nitrogen/generated/ios/swift/Func_void_MediaType_FrameDroppedReason.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/nitrogen/generated/ios/swift/Func_void_PhotoFile.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_ArrayBuffer_.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_HybridCameraDeviceFactorySpec_.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_HybridCameraSessionConfigSpec_.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_HybridCameraSessionSpec_.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_HybridDepthSpec_.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_HybridFrameSpec_.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_HybridPhotoSpec_.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_HybridRecorderSpec_.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_margelo__nitro__image__HybridImageSpec_.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/nitrogen/generated/ios/swift/Func_void_std__string.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/nitrogen/generated/ios/swift/Func_void_std__string_RecordingFinishedReason.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/nitrogen/generated/ios/swift/Func_void_std__vector_std__shared_ptr_HybridCameraControllerSpec__.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/nitrogen/generated/ios/swift/Func_void_std__vector_std__shared_ptr_HybridCameraDeviceSpec__.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/nitrogen/generated/ios/swift/Func_void_std__vector_std__shared_ptr_HybridCameraExtensionSpec__.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/nitrogen/generated/ios/swift/Func_void_std__vector_std__shared_ptr_HybridScannedObjectSpec__.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Hybrid\ Objects/Image\ Types/HybridCameraCalibrationData.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/nitrogen/generated/ios/swift/HybridCameraCalibrationDataSpec.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/nitrogen/generated/ios/swift/HybridCameraCalibrationDataSpec_cxx.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/ios/Hybrid\ Objects/HybridCameraController.swift /Users/expo/workingdir/build/node_modules/react-native-vision-camera/nitrogen/generated/ios/swift/HybridCameraControllerSpec.swift (in target 'VisionCamera' from project 'Pods')
▸ 	Archiving workspace front with scheme front
▸ (7 failures)
Exit status: 65
+---------------------------------------+
|           Build environment           |
+-------------+-------------------------+
| xcode_path  | /Applications/Xcode.app |
| gym_version | 2.227.2                 |
| sdk         | iPhoneOS18.5.sdk        |
+-------------+-------------------------+
Looks like fastlane ran into a build/archive error with your project
It's hard to tell what's causing the error, so we wrote some guides on how
to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/
Before submitting an issue on GitHub, please follow the guide above and make
sure your project is set up correctly.
fastlane uses `xcodebuild` commands to generate your binary, you can see the
the full commands printed out in yellow in the above log.
Make sure to inspect the output above, as usually you'll find more error information there
[!] Error building the application - see the log above
Error: The "Run fastlane" step failed because of an error in the Xcode build process. We automatically detected following errors in your Xcode build logs:
- type 'AVMetadataObject.ObjectType' has no member 'dogHead'
- type 'AVMetadataObject.ObjectType' has no member 'catHead'
- type 'AVMetadataObject.ObjectType?' has no member 'dogHead'
- type 'AVMetadataObject.ObjectType?' has no member 'catHead'
- type 'AVCaptureColorSpace' has no member 'appleLog2'
- type 'AVCaptureVideoStabilizationMode' has no member 'lowLatency'
- type 'AVVideoCodecType' has no member 'proResRAW'
- type 'AVVideoCodecType' has no member 'proResRAWHQ'
- type 'AVVideoCodecType' has no member 'proResRAW'
- type 'AVVideoCodecType' has no member 'proResRAWHQ'
Refer to "Xcode Logs" below for additional, more detailed logs.

Additional context

No response

Submission

  • [x] The reproduction I linked is either (preferred) a PR against this repo that adds a failing harness test following the harness-tests README, or (fallback) a public repo that reproduces the bug on a fresh clone. I understand the issue will be closed without one.
  • [x] I pasted logs as text (not screenshots).
  • [x] I wrote this report in my own words. I did not paste AI-generated descriptions of the bug.

YehorBoiar avatar Apr 30 '26 14:04 YehorBoiar

Upgrade to Xcode 26 , it is required by Apple https://developer.apple.com/news/upcoming-requirements/?id=02032026a

ralph1233 avatar May 02 '26 15:05 ralph1233

Please upgrade to Xcode 26

mrousavy avatar May 04 '26 07:05 mrousavy