Keywords: Xcode 10.2 | Build System Error | CocoaPods
Abstract: This article provides an in-depth examination of the build system error -1 that occurs after upgrading to Xcode 10.2, specifically manifesting as the inability to load Pods-related input/output file lists. The paper begins by analyzing the technical background of the error, identifying it as an incompatibility between Xcode 10.2's newly enabled build system and CocoaPods integration. It then details three solution approaches: updating CocoaPods to pre-release versions and rebuilding, completely cleaning and reintegrating Pods dependencies, and manually removing problematic file lists from build phases. By comparing the advantages and disadvantages of each method, this article offers comprehensive troubleshooting guidance to help developers thoroughly resolve this common build issue.
Problem Background and Technical Analysis
After upgrading to Xcode 10.2, many iOS developers encountered a specific build system error with code -1, specifically manifested as:
:-1: Unable to load contents of file list: 'xxxxx/Pods/Target Support Files/Pods-xxxx/Pods-xxxxx-frameworks-Debug-input-files.xcfilelist'
:-1: Unable to load contents of file list: 'xxxxx/Pods/Target Support Files/Pods-xxxxx/Pods-xxxxx-frameworks-Debug-output-files.xcfilelist'
The core issue lies in Xcode 10.2's default enabling of the new build system (New Build System), which has compatibility problems when processing file lists generated by CocoaPods. xcfilelist files are special format files used by Xcode to manage build input and output file lists. When the build system cannot correctly load these files, it results in build failure.
Solution One: Update CocoaPods and Rebuild
According to community-verified best practices, the most effective solution involves updating the CocoaPods toolchain:
- First update CocoaPods to the latest pre-release version:
sudo gem update cocoapods --pre - Execute in the project directory:
pod update - Clean Xcode build cache: Select Product > Clean Build Folder from Xcode menu
- Rebuild the project
The principle behind this method is that pre-release versions of CocoaPods typically contain fixes for the latest Xcode versions. By updating the toolchain, it ensures that the generated Pod project files are fully compatible with Xcode 10.2's new build system.
Solution Two: Complete Clean and Reintegration of Pods
When the first method proves ineffective, a more thorough cleanup approach can be attempted:
- Delete the Pods directory, Podfile.lock file, and .xcworkspace file in the project
- Execute the
pod deintegratecommand, which removes all CocoaPods integration traces from the project - Re-execute
pod installto generate fresh Pod integration
Although this method takes longer, it can resolve compatibility issues caused by残留的 old configurations. It's important to note that this approach completely resets Pods configuration and may require reconfiguration of some custom build settings.
Solution Three: Manual Modification of Build Phase Configuration
For scenarios requiring quick problem resolution, build phase configuration can be manually modified:
- Open the project in Xcode and select the problematic target
- Navigate to the Build Phases tab
- Expand the
[CP] Embed Pods Frameworksscript phase - In the Input Files Lists and Output Files Lists sections, select each file individually and click the
-button to remove them
This method directly removes the problematic file list references but may affect build integrity. It is recommended for emergency fixes, with the understanding that the first two methods should be used for permanent resolution.
Deep Technical Principle Analysis
Xcode 10.2's new build system employs different mechanisms for file dependency management. xcfilelist files contain file path lists that need to be processed during build. When these files don't exist or have incorrect paths, the new build system strictly reports errors, whereas the old build system might tolerate certain issues.
When CocoaPods generates these file lists using older generation logic, it may create formats incompatible with the new build system. Particularly when handling framework dependencies, synchronization between input and output file lists becomes critical.
Preventive Measures and Best Practices
To prevent similar issues from recurring, the following preventive measures are recommended:
- Update CocoaPods to the latest stable version before upgrading Xcode
- Regularly execute
pod updateto keep dependencies current - Consider standardizing Xcode and CocoaPods versions across development teams
- For critical projects, create backup branches for testing before upgrades
By understanding these technical details and solutions, developers can more effectively address compatibility issues arising from Xcode upgrades, ensuring smooth development workflows.