在包含Objective-C和Swift代码的自定义框架中,Swift编译器抛出以下错误:
[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'
Run Code Online (Sandbox Code Playgroud) 这个问题在过去几周内已经发展,以涵盖xcode4的更多一般性问题(以及从旧的xcode升级项目).
然而,许多问题可以通过遵循相同的指令集来解决.
如果您遇到以下任何问题,请尝试接受的答案中的方法:
标题:Xcode 4中的"未找到词法或预处理器问题文件"
我在Xcode 4中有一个项目,可以在设备和模拟器上运行良好,但在寻找与静态库关联的头文件时尝试归档它时出错:
In file included from /Volumes/Development/Path/LBProject/LBProject/LBProject-Prefix.pch:15:
In file included from /Volumes/Development/Path/LBProject/LBFDefines.h:23:
In file included from /Volumes/Development/Path/LBProject/Classes/LBProjectAppDelegate.h:11:
In file included from /Volumes/Development/Path/LBProject/LBProject/../FKNDirectory/FKNDirectoryManager.h:10:
/Volumes/Development/Path/LBProject/LBProject/../FKNDirectory/FKNDataModel.h:11:9: fatal error: 'Merchant.h' file not found [1]
#import "Merchant.h"
^
1 error generated.
Run Code Online (Sandbox Code Playgroud)
Xcode给出了错误
lexical or preprocessor issue file not found
Run Code Online (Sandbox Code Playgroud)
很多谷歌搜索显示很多人都有这个问题,但没有解决方案.任何人都得到了修复甚至线索.
更新:在user header搜索路径设置为${BUILT_PRODUCTS_DIR}所有配置.除了归档时,它使用任何配置构建良好.
更新2: Merchant.h …
compiler-construction objective-c clang xcode4 c-preprocessor
我通过import语句成功地从Objective C(针对目标'MyApp')调用我的Swift类:
#import "MyApp-Swift.h"
Run Code Online (Sandbox Code Playgroud)
我现在创建了一个名为"MyAppLite"的新目标
当我编译新目标时,我得到错误,因为代码需要"MyApp-Swift.h",但编译器正在创建"MyAppLite-Swift.h"
所以,我需要为#import我正在编译的目标创建一个条件Swift/ObjC头.
如何做到这一点,还是有更好的方法?