EAS build doesn't handle iOS version macro condition properly

I’m using managed workflow. eas-cli’s version is 5.4.0.
I encountered the following error message with eas build, while the project is succesfuly built with expo build:ios in local.

❌  (/Users/expo/workingdir/build/app/node_modules/react-native-vision-camera/ios/Extensions/AVCaptureOutput+mirror.swift:41:23)

  39 |         let degrees = cameraOrientation.toDegrees()
  40 | 
> 41 |         if connection.isVideoRotationAngleSupported(degrees) {
     |                       ^ value of type 'AVCaptureConnection' has no member 'isVideoRotationAngleSupported'
  42 |           connection.videoRotationAngle = degrees
  43 |         }
  44 |       } else {


❌  (/Users/expo/workingdir/build/app/node_modules/react-native-vision-camera/ios/CameraDevicesManager.swift:43:44)

  41 |     let preferredDevice: [String: Any]?
  42 |     if #available(iOS 17.0, *),
> 43 |        let userPreferred = AVCaptureDevice.userPreferredCamera {
     |                                            ^ 'userPreferredCamera' is unavailable in iOS
  44 |       preferredDevice = userPreferred.toDictionary()
  45 |     } else {
  46 |       preferredDevice = devices.first

These two error messages originate from the usage of if #available(iOS 17.0, *). It seems that the code within the if #available(iOS 17.0, *) is not being evaluated properly, causing a failure when building the code with the iOS 17.0 SDK. Is my understanding correct?

It’s also worth noting that other macros with SDK version constraints, such as if #available(iOS 15.0, *), do not appear to have any issues. The error only occurs when the specified version is 17.0.

Does anyone have any insights into what might be happening here?

you should check what xcode version is being used in your project on eas build. you can update it by selecting the appropriate image: Build server infrastructure - Expo Documentation

it could be that a version of the library you’re using is compatible with your local xcode version but not the default version on eas build.

1 Like