Xcode 9 “could not build module ‘Foundation’”

2020-03-26 05:17发布

问题:

When I archive an iPhone project, it returns a failure:

Could not build module "Foundation".

However, when I debug on the iPhone, it runs successfully.

I tried to set ‘Enable Modules’ to No and it seems normal, but another 3rd party library I'm using requires modules be turned on.

What do I do in that case? How do I import social now?

回答1:

Set to YES target's Allow Non-modular Includes in Framework Modules in Build Settings.



回答2:

Only reinstalling Xcode worked for me.



回答3:

This happened to me after trying to build a third party library. It made a symbolic link in the iPhoneOS.sdk/usr/include to a non-existent header file in iPhoneSimulator.sdk/usr/include.

After deleting the bad symbolic link, Xcode started building correctly again.



回答4:

what you could try is :

  1. Remove your pod.lock file
  2. Remove your node_modules
  3. yarn install in root dir
  4. cd ios
  5. pod install
  6. clean build folder
  7. build