【发布时间】:2014-06-21 14:16:00
【问题描述】:
我尝试了几个小时将 Hpple 集成到一个新的 Swift 项目中,但没有成功。我复制到项目中有 6 个文件 TFHpple.h TFHpple.m、TFHppleElement.h TFHppleElement.m 和 TFHppleElement.h TFHppleElement.m。
作为一个用 Swift 编写的项目,我在 -Bridging-Header.h 中声明了三个 .h 文件,这样我就可以使用用 Objective-C 编写的它们了。 TFHpple.h 没有出现任何错误,但其他两个类对声明的每个变量都给出错误:
未知类型名称'NSArray'
可能是什么问题?
这是我的 Brigging-Header.h
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#import <Foundation/Foundation.h>
#import "TFHpple.h"
#import "TFHppleElement.h"
#import "XPathQuery.h"
【问题讨论】:
-
顺便说一句,你在 Swift 文件中添加了
import Foundation吗? -
是的,我确实在我的 ViewController swift 文件中导入了 Foundation。
标签: ios objective-c xcode swift