Swift Framework: Umbrella header '[...].h' not found
In a custom framework containing both Objective-C and Swift code, the Swift compiler throws the following error:
[build_path]/unextended-module.modulemap:2:19: error: umbrella header 'bugtest.h' not found
umbrella header "bugtest.h"
^
<unknown>:0: error: could not build Objective-C module 'bugtest'
Solution 1:
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.
Solution 2:
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
Solution 3:
There's 4 different ways this can happen, ignoring bugs in previous versions of Xcode
- You don't have a umbrella header named $(TARGET_NAME).h in your project
- You have a umbrella header, but it's not set as public. See arturgrigor's answer
-
DEFINES_MODULE
is not set toYES
-
CLANG_ENABLE_MODULES
is not set toYES
Solution 4:
This will happen, when the Always Search User Paths
setting is enabled for the Framework target.
Setting it to No
will resolve that error.
IMHO this is a bug in the Swift Compiler and I have filed a radar with Apple.
See rdar://21038443