如何检索丢失的桥接头 [英] How to retrieve bridging headers that has been lost

查看:27
本文介绍了如何检索丢失的桥接头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的应用程序中放入 Facebook 登录信息.我也在检查一些可以帮助我做到这一点的教程.然后我创建了一个头文件,我也将其删除,因为我无法完成我正在观看的教程.然后突然之间,我遇到了一个错误,说明...

I was trying to put a facebook login in my app. I'm also checking some of the tutorials that'll help me to do this. Then i have created a header file that i also delete since that i wasn't able to accomplished the tutorial that i'm watching. Then all of a sudden, i'm having an error that stating...

Briding Header 'Users/mac/Desktop/AppFiles/myApp/myApp-Bridging-Header.h' 不存在

Briding Header 'Users/mac/Desktop/App Files/myApp/myApp-Bridging-Header.h' does not exist

我不知道为什么会这样.我尝试删除我的 .swift 文件并用相同的名称替换它,然后它仍然有错误.我什至尝试使用不同的名称制作一个 .swift 文件,但仍然有错误.

I don't know why is that happening. I try to delete my .swift file and replace it with the same name then it still having an error. I even try to make a .swift file with a different name but still having an error as well.

推荐答案

In build settings.. in Swift Compiler -Code Generation"—> Objective-C Bridging Header — reset the Path of Bridging header file"

In build settings.. in "Swift Compiler -Code Generation"—> Objective-C Bridging Header — "reset the Path of Bridging header file"

如何手动创建 Swift 桥接头

How to create a Swift Bridging Header Manually

  • 向 Xcode 添加一个新文件(文件 > 新建 > 文件),然后选择源"和单击头文件".

  • Add a new file to Xcode (File > New > File), then select "Source" and click "Header File".

将您的文件命名为YourProjectName-Bridging-Header.h".示例:在我的app Station,文件名为Station-Bridging-Header".

Name your file "YourProjectName-Bridging-Header.h". Example: In my app Station, the file is named "Station-Bridging-Header".

创建文件.

导航到您的项目构建设置并找到Swift Compiler– 代码生成"部分.您可能会发现输入Swift编译器"进入搜索框以缩小结果范围.注意:如果你没有Swift Compiler – Code Generation"部分,这个意味着您的项目中可能没有添加任何 Swift 类然而.添加 Swift 文件,然后重试.

Navigate to your project build settings and find the "Swift Compiler – Code Generation" section. You may find it faster to type in "Swift Compiler" into the search box to narrow down the results. Note: If you don’t have a "Swift Compiler – Code Generation" section, this means you probably don’t have any Swift classes added to your project yet. Add a Swift file, then try again.

在Objective-C Bridging Header"旁边,您需要添加头文件的名称/路径.如果您的文件位于项目的根文件夹只是将头文件的名称放在那里.例子:ProjectName/ProjectName-Bridging-Header.h" 或者干脆ProjectName-Bridging-Header.h".

Next to "Objective-C Bridging Header" you will need to add the name/path of your header file. If your file resides in your project’s root folder simply put the name of the header file there. Examples: "ProjectName/ProjectName-Bridging-Header.h" or simply "ProjectName-Bridging-Header.h".

打开您新创建的桥接头并导入您的使用#import 语句的Objective-C 类.列出的任何类可以从您的 swift 类访问此文件.

Open up your newly created bridging header and import your Objective-C classes using #import statements. Any class listed in this file will be able to be accessed from your swift classes.

这篇关于如何检索丢失的桥接头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆