Skip to content

🐛 withXCode.js creates problems with deploymentTarget forcing it to 16.4 #1066

Description

@xgiovio

What's happening?

Some projects like react-native-executorch have a min deploymentTarget of 17.0, if in the same project we use also react-native-quick-crypto we can't set the deploymentTarget from the app.json because the react-native-quick-crypto expo module overrides it.

Reproducible Code

const withXCode = config => {
  // Use expo-build-properties to bump iOS deployment target
  config = (0, _expoBuildProperties.withBuildProperties)(config, {
    ios: {
      deploymentTarget: '16.4'
    }
  });
  // Patch the generated Podfile fallback to ensure platform is always 16.4
  config = (0, _configPlugins.withDangerousMod)(config, ['ios', modConfig => {
    const podfilePath = _path.default.join(modConfig.modRequest.platformProjectRoot, 'Podfile');
    let contents = _fs.default.readFileSync(podfilePath, 'utf-8');

    // Check if the IPHONEOS_DEPLOYMENT_TARGET setting is already present
    // We search for the key being assigned, e.g., config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] =
    const deploymentTargetSettingExists = /\.build_settings\s*\[\s*['"]IPHONEOS_DEPLOYMENT_TARGET['"]\s*\]\s*=/.test(contents);
    if (!deploymentTargetSettingExists) {
      // IPHONEOS_DEPLOYMENT_TARGET setting not found, proceed to add it.
      contents = contents.replace(/(post_install\s+do\s+\|installer\|[\s\S]*?)(\r?\n\s\send\s*)$/m, `$1

    # Expo Build Properties: force deployment target
    # https://github.com/mrousavy/nitro/issues/422#issuecomment-2545988256
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '16.4'
      end
    end
$2`);
    }
    _fs.default.writeFileSync(podfilePath, contents);
    return modConfig;
  }]);
  return config;
};

Relevant log output

the Podfile.properties.json and Podfile have hardcoded version 16.4

Device

17 pro max

QuickCrypto Version

latest

Can you reproduce this issue in the QuickCrypto Example app?

Yes, I can reproduce the same issue in the Example app here

Additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions