问题描述
几个月前,我开发了一个简单的IOs应用,通过 NMSSH 通过SSH控制Raspberry Pi,这个应用程序是用obj-c开发的,我想在Swift中也使用devellop,所以我将NMSSH库导入相同,然后按照此以便通过桥接导入nmssh,因此我可以在我的swift文件中使用该库,但是我要编译我有117错误,因为xCode看到NMSSH文件就像swift文件一样而不是obj-c文件,我也不知道为什么或如何解决这个问题.抱歉,如果这是一个简单的问题,但是我尝试学习Swift,而作为法语,它对Engloish中的所有文档都不是那么简单.谢谢.
I developed a simple IOs app to control a Raspberry Pi through SSH using NMSSH few month ago, this app is developped with obj-c and I would like to devellop alost the same in Swift so i import the NMSSH library the same and I follow this to import nmssh with bridging so I can use the library in my swift file but i wan tto compile I have 117 error because xCode see NMSSH file like swift files and not obj-c files and I don't have any idea why or how to solve this.Sorry if that's a simple question but I try to learn Swift and as a french it's not pretty simple with all documentation in Engloish. Thanks.
推荐答案
首先按照iOS开发者库中的说明使用使用Objective-C快速浏览.第二个包括:
First follow the instruction in iOS Developer library about using Swift with Objective-C.Second include:
#import <Foundation/Foundation.h>
然后NMSSH导入
#import <NMSSH/NMSSH.h>
在您的Bridging header
文件中
我对这个框架是陌生的,但是基金会似乎包含了原始对象的信息/定义.
I am new with this framework but it seems like the Foundation contain information/definition of primitive objects.
还要更详细地检查以下答案:如何调用Objective- Swift中的C代码
Also check this answer in more detail: How to call Objective-C code from Swift
这篇关于如何快速使用NMSSH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!