Skip to content

Fix CocoaPods Error: Unable to Find Compatibility Version for Object Version '70'

Problem Description

When adding a Share Extension to a Flutter iOS project in Xcode 16, running pod install frequently fails with the error:

CopyArgumentError - [Xcodeproj] Unable to find compatibility version string for object version `70`.

This occurs because Xcode 16 automatically updates your project's configuration to use object version 70 when certain new features (like adding Share Extensions or using Xcode 16-specific functionality) are implemented. However, CocoaPods versions older than 1.17 don't recognize this version string.

Common scenarios triggering this error:

  • Adding a new Share Extension target
  • Using Xcode 16-specific features like "New Folder" in Project Navigator
  • Working with Flutter projects where CocoaPods manages dependencies

Affected environment:

  • CocoaPods: 1.16.2 (or older)
  • Xcode: 16+
  • Flutter projects with iOS targets

Solutions

Solution 1: Change Project Compatibility Version via Xcode UI

The most reliable fix involves reverting your project's compatibility settings:

  1. Open your project in Xcode
  2. Select your project name in the Project Navigator
  3. Under the PROJECT section (not TARGETS), locate Project Format
  4. Change from Xcode 16.0-compatible to an older compatible version like Xcode 14.0-compatible'Project Format' setting location
  5. Save changes and close Xcode
  6. Run:
    bash
    pod install

Solution 2: Edit project.pbxproj Manually

If Xcode doesn't resolve the issue, manually edit the configuration:

  1. Right-click your .xcodeproj file → Show Package Contents
  2. Open project.pbxproj in a text editor
  3. Search for:
    properties
    objectVersion = 70;
  4. Change 70 to a compatible version (typically 60):
    properties
    objectVersion = 60;
  5. Optionally update compatibilityVersion:
    properties
    compatibilityVersion = "Xcode 14.0";
  6. Save and run:
    bash
    pod deintegrate
    pod install

Solution 3: Convert Folders to Groups

If you've used Xcode 16's "New Folder" feature, which forces version 70:

  1. In Xcode Project Navigator:
    • Right-click any Folder (blue icons)
    • Select Convert to GroupFolder conversion location
  2. Repeat for all folders until only groups (yellow icons) remain
  3. Verify objectVersion reverted to 60 in project.pbxproj
  4. Run:
    bash
    pod install

Why This Works

  • Xcode 16 introduces new project formats (version 70) that older CocoaPods versions don't support
  • Reverting to version 60 maintains compatibility with existing dependencies
  • Converting folders to groups eliminates Xcode 16-specific features that trigger version upgrades
  • These changes don't affect functionality—only how Xcode organizes project metadata

Prevention Tips

  1. Always back up project.pbxproj before editing
  2. For new projects, check compatibility version before adding extensions:
    bash
    grep 'objectVersion' YourProject.xcodeproj/project.pbxproj
  3. Update CocoaPods regularly:
    bash
    sudo gem update cocoapods
  4. Avoid "New Folder" in Xcode 16+; use "New Group" instead

Compatibility Notes

ComponentSupported Version
CocoaPodsVersions before 1.17
Xcode16+
Works withFlutter, React Native, native iOS

Still encountering issues? Ensure all folders have been converted to groups and that your Podfile correctly references both targets:

ruby
target 'Runner' do
  use_frameworks!
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

target 'Share Extension' do
  # Add shared pod dependencies here
  pod 'SharedPod'
end