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:
- Open your project in Xcode
- Select your project name in the Project Navigator
- Under the PROJECT section (not TARGETS), locate Project Format
- Change from
Xcode 16.0-compatible
to an older compatible version likeXcode 14.0-compatible
- Save changes and close Xcode
- Run:bash
pod install
Solution 2: Edit project.pbxproj Manually
If Xcode doesn't resolve the issue, manually edit the configuration:
- Right-click your
.xcodeproj
file → Show Package Contents - Open
project.pbxproj
in a text editor - Search for:properties
objectVersion = 70;
- Change
70
to a compatible version (typically60
):propertiesobjectVersion = 60;
- Optionally update
compatibilityVersion
:propertiescompatibilityVersion = "Xcode 14.0";
- 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:
- In Xcode Project Navigator:
- Right-click any Folder (blue icons)
- Select Convert to Group
- Repeat for all folders until only groups (yellow icons) remain
- Verify
objectVersion
reverted to 60 in project.pbxproj - 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
- Always back up
project.pbxproj
before editing - For new projects, check compatibility version before adding extensions:bash
grep 'objectVersion' YourProject.xcodeproj/project.pbxproj
- Update CocoaPods regularly:bash
sudo gem update cocoapods
- Avoid "New Folder" in Xcode 16+; use "New Group" instead
Compatibility Notes
Component | Supported Version |
---|---|
CocoaPods | Versions before 1.17 |
Xcode | 16+ |
Works with | Flutter, React Native, native iOS |
Still encountering issues? Ensure all folders have been converted to groups and that your Podfile
correctly references both targets:
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