问题
When I integrate a local package in my Xcode project everything is fine initially but when i switch branches and want to run the app Xcode gives me the compile error Missing package product <package name>
. When I quit Xcode and re-open it everything is fine again. Any idea what this can be? An Xcode bug?
We also integrate external packages via Swift Package Manager which works perfectly fine. No issues there.
The issue is also well described in a post by Jesse Squires.
回答1:
For me, I needed File > Swift Packages > Reset Package Caches
回答2:
In Xcode go to File > Swift Packages > Update to Latest Package Versions
Worked for me
回答3:
In Xcode go to Product > Clean Build Folder
This worked for me. The problem originally started when I was trying to solve another issue that came up after I deleted my Derived Data folder.
Restarting Xcode didn't work, but cleaning the build folder did. I don't know if the other answers here would work for me because I didn't try them seeing as cleaning the build folder worked.
回答4:
I'm not sure of the root cause, but I get this quite regularly. Not the most elegant solution, but neither Reset Package Caches nor Update to Latest Package Versions worked for me. For me, I had to quit Xcode, and delete DerivedData.
rm -rf ~/Library/Developer/Xcode/DerivedData/*
Then rebuild.
回答5:
In Xcode 12.0.1 (12A7300) this bug has been fixed. At least I don't get it anymore 🎉
来源:https://stackoverflow.com/questions/60952549/xcode-11-4-compile-error-missing-package-product-package-name