xcode 如何删除桥头而不会出错?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32274684/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 07:44:07  来源:igfitidea点击:

How do I remove a bridge header without getting errors?

iosobjective-cxcodeswiftobjective-c-swift-bridge

提问by Caleb Kleveter

I added a bridge header to my app the other day because I was trying to add Objective-C files to my Swift project. I was having trouble getting the connection to work(and I also did not know how to implement the Objective-C files), so I decided I wanted to start over again. I deleted the Objective-C files and the Bridge-Header file and now I am getting an error saying:
<unknown>:0: error: bridging header '/Users/CalebKleveter/Documents/Development/iOS/personal/swift/Projects/Dicey/Dicey/Dicey-Bridging-Header.h' does not exist

前几天我在我的应用程序中添加了一个桥头文件,因为我试图将 Objective-C 文件添加到我的 Swift 项目中。我在连接工作时遇到了麻烦(而且我也不知道如何实现 Objective-C 文件),所以我决定重新开始。我删除了 Objective-C 文件和 Bridge-Header 文件,现在我收到一条错误消息:
<unknown>:0: error: bridging header '/Users/CalebKleveter/Documents/Development/iOS/personal/swift/Projects/Dicey/Dicey/Dicey-Bridging-Header.h' does not exist

Xcode Bridge-Header errorFile tree for an Xcode project

Xcode 桥头错误Xcode 项目的文件树

回答by egor.zhdan

Go to Build Settingsof your project, find Objective-C Bridging Headerrow and remove its contents.

转到项目的Build Settings,找到Objective-C Bridging Header行并删除其内容。

enter image description here

在此处输入图片说明

回答by Team chang

enter image description hereGo to targets file->Build Settings->Swift Compiler - General, delete the contents in the same line as Objective-C Bridging Header

在此处输入图片说明进入targets file->Build Settings->Swift Compiler - General,删除Objective-C Bridging Header所在行的内容

回答by Logan

Deleting the lines containing SWIFT_OBJC_BRIDGING_HEADERin MyProjectName.xcodeproj/project.pbxprojdid the trick for me.

删除包含SWIFT_OBJC_BRIDGING_HEADERin的行MyProjectName.xcodeproj/project.pbxproj对我来说很有效。

I could not find the Build Settings in my Xcode project as other answers mentioned (maybe because my project is for MacOS, not iOS?).

我无法在我的 Xcode 项目中找到构建设置,正如提到的其他答案(可能是因为我的项目适用于 MacOS,而不是 iOS?)。