最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

[已解决]swift中Bridging header Bridging-Header.h does not exist

Swift crifan 5688浏览 0评论

之前一直正常的,结果在加入一个object-C的库,然后自动添加了一个bridge header

然后后来又删除该库,包括对应的bridge header,结果再去编译,就出错了:

Bridging header ‘/Users/crifan/dev/dev_root/daryun/JianDao/iOS-Client/JianDao/JianDao-Bridging-Header.h’ does not exist

即使clean后再去编译,还是同样错误。

搜:

xcode Bridging header Bridging-Header.h does not exist

ios – Xcode MyProjectName-Bridging-Header.h does not exist – Stack Overflow

此处是空的:

去通过git commit发现了点区别:

多余了:

SWIFT_OBJC_BRIDGING_HEADER = "JianDao-Bridging-Header.h";
                SWIFT_OPTIMIZATION_LEVEL = "-Onone";

搜:

Xcode SWIFT_OBJC_BRIDGING_HEADER

然后点击全部,才看到:

所以:

去掉:

SWIFT_OBJC_INTERFACE_HEADER_NAME

$(SWIFT_MODULE_NAME)-Swift.h

然后发现已经没了:

再去编译看看

结果还是出错:

去把:

SWIFT_INSTALL_OBJC_HEADER

从yes设置为no试试:

错误依旧。

结果发现还有:

984AE8461BDF299400B5E8DB /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
HEADER_SEARCH_PATHS = (
"$(SRCROOT)/XMPPFramework/module/**",
"$(SRCROOT)/XMPPFramework/Vendor/**",
"$(inherited)",
);
INFOPLIST_FILE = JianDao/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(SRCROOT)/**",
"$(inherited)",
);
PRODUCT_BUNDLE_IDENTIFIER = com.daryun.JianDao;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_OBJC_BRIDGING_HEADER = "JianDao-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};

然后切换到:

Target-》Build Settings-》All-》Swift Compiler -Code Generation ->Object give-C Bridge Header

(对应内部变量:

//:configuration = Debug

SWIFT_OBJC_BRIDGING_HEADER = JianDao-Bridging-Header.h

//:configuration = Release

SWIFT_OBJC_BRIDGING_HEADER = JianDao-Bridging-Header.h

//:completeSettings = some

SWIFT_OBJC_BRIDGING_HEADER

清空:

即可。

然后再去确认,也就没这几个属性的配置了:

[总结]

去:

Project->Build Settings->All->Swift Compiler -Code Generation->Object give-C Bridge Header

Target->Build Settings->All->Swift Compiler -Code Generation->Object give-C Bridge Header

中,把对应的,之前有的值清空掉。重新编译,即可消除错误。

转载请注明:在路上 » [已解决]swift中Bridging header Bridging-Header.h does not exist

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
86 queries in 0.351 seconds, using 22.08MB memory