简体   繁体   English

如何在我的xcode项目中导入此文件

[英]How to import this file in my xcode project

I am new to iOS development and XCode. 我是iOS开发和XCode的新手。 I am trying here to use a library for my project but I can't manage to include it into my main controller. 我在这里尝试为我的项目使用一个库,但是我无法设法将其包含到我的主控制器中。 I am using XCode 10. 我正在使用XCode 10。

As I see in the reference project I am using, I should't even have to import it, but yet, it can't seem to recognize when i use the Delegate Any idea how to process this ? 正如我在参考项目中所看到的,我什至不必导入它,但是,当我使用Delegate时,它似乎无法识别。 Thanks 谢谢

I have tried quite a large number of solutions : typo, moving the file, settings,adding it into my libraries ... 我尝试了很多解决方案:错字,移动文件,设置,将其添加到我的库中...

import "../DTDevices.h"
#import "../DTDevices.h"
import DTDevices.h
....

在此处输入图片说明

If you are importing the class into a swift file, you do not need to reference the path for your file (Xcode treats all files as a flat surface). 如果要将类导入到快速文件中,则无需引用文件的路径(Xcode将所有文件视为平面)。 You can import just DTDevices. 您只能导入DTDevices。

import DTDevices

If DTDevices is an objc file, you need to import this file in a bridger file.. 如果DTDevices是objc文件,则需要将此文件导入到桥接器文件中。

https://www.ios-blog.com/tutorials/objective-c/how-to-use-objective-c-classes-in-swift/ https://www.ios-blog.com/tutorials/objective-c/how-to-use-objective-c-classes-in-swift/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM