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

后端 未结 22 2022
盖世英雄少女心
盖世英雄少女心 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:04

    If you're using Xcode 7.1 and CocoaPods 0.39, there seems to be a swift compiler change that affects some CocoaPods (Nimble, Quick, etc.) Try some of the solutions specified in the this thread: https://github.com/CocoaPods/CocoaPods/issues/4420 however, if neither of them work, try using Xcode 7.0.1 or 7.2 beta. You can get both of them here: https://developer.apple.com/downloads/.

    Edit: In my case, to fix the issue, I also had to downgrade CocoaPods to 0.38.2.

    Later edit: It seems not to be related to Xcode 7.1. Just downgrading CocoaPods to 0.38.2 should help:

    sudo gem uninstall cocoapods -v 0.39
    sudo gem install cocoapods -v 0.38.2
    
    0 讨论(0)
  • 2020-12-07 12:06

    make sure "import paths" in Build Settings includes the file you're trying to include...

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

    I fixed it by making the Compilation Mode of the problematic framework build settings to Incremental.

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

    In my case problem was caused by remove headers script in Build Phases

    function removeHeaders() {  
        find $BUILD_ROOT/...  -name '*.h' -exec rm -f {} \;  
    }  
    removeHeaders
    

    Deleting this script fixed the problem.

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

    One more solution: After renaming a folder, the old location might still be listed in the project file for the .h file, even if you updated the location via Xcode's side-bar. This old location causes the umbrella-header error.

    Simple solution: Remove the reference to the .h file, and re-add. (and then remember to make it public again!)

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

    Your header file needs to be in the [Build Phases/Headers/Public] section.

    If your header file is already in the [Build Phases/Headers/Public] section, many times doing the fallowing solved my problem:

    1. clean the project
    2. move the header file to the "private" or "project" section
    3. move the header file back to the "public" section
    4. rebuild everything again
    0 讨论(0)
提交回复
热议问题