简体   繁体   English

在Swift 3 / Xcode 8(SharkORM)中安装第三方Objective-C库

[英]Installing third party Objective-C library within Swift 3 / Xcode 8 (SharkORM)

Im pretty new to Xcode/Swift and want to install a third party library(SharkORM). 我是Xcode / Swift的新手,想安装第三方库(SharkORM)。

I drag'n'dropped the folder "SharkORM" into XCode and selected "Create groups". 我将文件夹“ SharkORM”拖放到XCode中,然后选择了“创建组”。 Then i created a file "Swift-Bridging-Header.h" and typed in #include “SharkORM.h” as described in the documentation . 然后,我创建了一个文件“ Swift-Bridging-Header.h”,并按照文档中的说明输入了#include “SharkORM.h” When i hold CMD and click on it it leads me to the interface declaration(good!?). 当我按住CMD并单击它时,它会带我到接口声明(好!?)。 Now when i try to use it: class MyClass: SRKObject { ... } i get an error: "Use of undeclared type 'SRKObject'". 现在,当我尝试使用它时: class MyClass: SRKObject { ... }我收到一个错误:“使用未声明的类型'SRKObject'”。 But i can CMD+click on it which leads me to the interface declaration again. 但是我可以CMD +单击它,这又将我引向接口声明。

I tried to install with Cocoapod, too, with no success. 我也尝试安装Cocoapod,但没有成功。

As posted on GitHub, it sounds like the header file you created has not been added to the build settings as the chosen bridging header. 正如在GitHub上发布的那样,听起来您创建的头文件尚未作为所选的桥接头添加到构建设置中。

That is the most likely scenario leading to the object not being defined in your swift code. 这是最有可能导致未在快速代码中定义对象的情况。

Check, if SharkORM.h contains SRKObject declaration. 检查SharkORM.h是否包含SRKObject声明。 If not, find header file with it and place it to bridging header too 如果没有,则查找带有它的头文件并将其也放置到桥接头文件中

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

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