Xcode 16:
I encountered the same error and discovered it was due to an Xcode settings issue. In my case, I had to set the project's 'Project Format' value to Xcode 16. If this value is not set to Xcode 16, the object version in your pbxproj file will be 70 instead of 77.
credit: https://github.com/CocoaPods/CocoaPods/issues/12671#issuecomment-2467142931