xcode 错误,桥接头 test.h 不存在

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37806831/
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 08:53:37  来源:igfitidea点击:

Error, bridging header test.h does not exist

xcodexcode7objective-c-swift-bridge

提问by Timo Cengiz

So I am going crazy, since I keep on getting the error as described in the title and nothing that I worked.

所以我快疯了,因为我一直收到标题中描述的错误,而我没有工作。

I will show you what I have tried:

我将向您展示我的尝试:

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

What else can I do?

我还可以做些什么?

Please help.

请帮忙。

回答by Mandeep Singh

Creating Bridging Header File Manually

手动创建桥接头文件

First of all delete the Bridging header filewhich Xcode or may be you have created. And Select your project goto > Build Settings> Search the keyword. Swift Compiler - General. Click on Objective-C Bridging Header , delete that path. Now clean your Project.

首先删除Xcode 或您可能创建的桥接头文件。并选择您的项目转到 >构建设置> 搜索关键字。Swift 编译器 - 通用。单击 Objective-C Bridging Header ,删除该路径。现在清理你的项目。

Now select your project > Click on Windowin the navigation bar . Select Projectsand delete your deriveddata from there.

现在选择您的项目 > 单击导航栏中的窗口。选择项目并从那里删除您的派生数据。

Now create a new file, select the Sourceand then select the Header Fileand create your Bridging header file . File name must be your projectname-Bridging-Header.hand then create it

现在创建一个新文件,选择Source,然后选择Header File并创建您的 Bridging 头文件。文件名必须是你的projectname-Bridging-Header.h然后创建

Select your project goto> Build Settings> Search the keyword. Swift Compiler - General. Click on Objective-C Bridging Header and now add the path in this Objective-C Bridging Header like projectname-Bridging-Header.h

选择您的项目转到>构建设置> 搜索关键字。Swift 编译器 - 通用。单击Objective-C Bridging Header,然后在此Objective-C Bridging Header 中添加路径,如 projectname-Bridging-Header.h

Now import your classes into bridging header file and you can compile it your code easily.

现在将您的类导入桥接头文件,您可以轻松地将其编译为您的代码。

Your bridging header file looks like this when you are creating your file manually.

手动创建文件时,桥接头文件如下所示。

回答by iOS

In your project you don't have bridging-Header.h file, but your project has that path. For this you need to delete that path...

在您的项目中,您没有 bridging-Header.h 文件,但您的项目具有该路径。为此,您需要删除该路径...

Go to targets file and select Build Settings, ---->Swift Compiler - General, and delete the bridging-Header.h. Follow below screen shots....enter image description here

转到目标文件并选择 Build Settings,---->Swift Compiler - General,然后删除 bridging-Header.h。按照下面的屏幕截图......在此处输入图片说明

Delete the bridging-Header.h file in Swift Compiler - General

删除 Swift Compiler - General 中的 bridging-Header.h 文件

enter image description here

在此处输入图片说明

Now you got like this...

现在你变成这样了...

enter image description here

在此处输入图片说明

回答by Madavaram Ramesh

remove path at project goto > Build Settings > Search the keyword. Swift Compiler - General -> Objective-C Bridging header worked for me.

在项目 goto > Build Settings > Search the keyword 中删除路径。Swift Compiler - General -> Objective-C Bridging header 对我有用。

回答by Cristea Victor

If above solutions doesn't work, follow this steps:

如果上述解决方案不起作用,请按照以下步骤操作:

  1. Create bridging header as usually.
  1. 像往常一样创建桥接头。

enter image description here

在此处输入图片说明

  1. in Build Settings add prefix + / + bridging file name.
  1. 在构建设置中添加前缀 + / + 桥接文件名。

enter image description here

在此处输入图片说明

This works for me!

这对我有用!