Swift Framework: Umbrella header '[…].h' not found

后端 未结 22 2021
盖世英雄少女心
盖世英雄少女心 2020-12-07 11:49

In a custom framework containing both Objective-C and Swift code, the Swift compiler throws the following error:

[build_pat         


        
相关标签:
22条回答
  • 2020-12-07 12:10

    Remove these files from project's directory. .xcworkspace pods/ and podfile.lock

    update the pod and build the project.

    0 讨论(0)
  • 2020-12-07 12:12

    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

    0 讨论(0)
  • 2020-12-07 12:14

    In my case, I just built the specific framework with it's scheme. And then rebuild the entire project and it resolved the issue

    0 讨论(0)
  • 2020-12-07 12:15

    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.

    0 讨论(0)
  • 2020-12-07 12:17

    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.

    0 讨论(0)
  • 2020-12-07 12:18

    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.

    0 讨论(0)
提交回复
热议问题