In a custom framework containing both Objective-C and Swift code, the Swift compiler throws the following error:
[build_pat
Remove these files from project's directory.
.xcworkspace
pods/
and podfile.lock
update the pod and build the project.
I found that with the New Swift Build System and Parallelize Build turned on the scheme I would get errors like in this question. The solution was to link to frameworks that had been imported in the swift source files. (I think previously the app would build because it just happened that the frameworks were linked to something built previously in the serial build queue).
I wrote a script to go through all the imports in all the targets in a workspace and make sure that their frameworks have been linked to in that target.
https://github.com/Jon889/SwiftImportChecker
In my case, I just built the specific framework with it's scheme. And then rebuild the entire project and it resolved the issue
None of the 9 answers helped me, so I tried to create a new project which I could send to Apple to file a bug. I was surprised that I couldn’t reproduce the issue. I checked the build settings and they were equivalent. Apparently this is some kind of bug.
If nothing else helps, try to create a new project and import at least some Objective C & Swift classes from your current project, compare your framework-related build settings to the default values from the new project, and eventually move all files over to the new project.
In my experience you have to choose on the targets the framework which is giving you the error, not the project target.
Then compile, and after compiling it will be available on the project target.
I've been working on it for a whole day,but it's worth it.I tried all the ways here, but I didn't solve it. I created a new project, an experiment, and I found out User Header Search Path was setted ${SRCROOT} recursive, and I changed it to ${SRCROOT} non-recursive, changed the bridging header path(e.g. #import "SVProgressHUD.h"
-> #import "Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.h"
), the error went away.