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

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

    For me - access level was public but it also fails on umbrella not found. I did move the "Headers" section of the "Build phases" to the top and it started to work. Script to podfile:

    post_install do |installer|
    installer.pods_project.targets.each do |target|
        phase_name = 'Headers'
        target.build_phases.each do |phase|
            if (phase.display_name.include? phase_name)
                target.build_phases.unshift(phase).uniq! unless target.build_phases.first == phase
            end
        end
    end
    

    Have no clue why it is happening. Tried on dummy projects - not happening. Only on big ones with multiple dependencies. Something with compiling BEFORE copying umbrella headers.

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

    This usually happens after a project rename or something like that. The problem is that the umbrella header is no longer listed as a Public header. Check the attached image to see how to fix this.

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

    In Xcode 7 Beta, with Swift 2, it will also happen if your Framework Header is not declared as "Public"

    For instance, I had a Cocoa Touch Framework with a "Project" visibility for the header file, and the error "Umbrella Header ... not found" for all Swift files in my project, once I had the header "Public", the error went away

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

    I solved this by renaming my module.modulemap to moduleXYZ.modulemap and changing the modulemap file name in the project settings

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