【发布时间】:2016-02-14 19:12:00
【问题描述】:
我试图在我的旧 Objc 代码中测试一些 Swift 类(@objc 类)。我在我的测试类中导入“UnitTests-Swift.h”。
然后我得到这个错误:
在自动生成的“UnitTests-Swift.h”中找不到模块“MyApp”
这是“UnitTests-Swift.h”顶部的内容
typedef int swift_int3 __attribute__((__ext_vector_type__(3)));
typedef int swift_int4 __attribute__((__ext_vector_type__(4)));
#if defined(__has_feature) && __has_feature(modules)
@import XCTest;
@import ObjectiveC;
@import MyApp;
@import CoreData;
#endif
我清理了项目,检查了所有相关标志("No such module" when using @testable in Xcode Unit tests,Can't use Swift classes inside Objective-C),删除了派生数据等等。不知道发生了什么,但我很确定 @import MyApp 不应该在那里。 .
谁能帮我解决这个问题?
【问题讨论】:
-
我也遇到了这个问题。
-
应要求,我已将其归档在 Swift 错误数据库中:bugs.swift.org/browse/SR-3381
-
这是可以在 Xcode 7 中重现的东西,还是需要使用旧版本制作的 obj-c 项目?你能提供从头开始重现的步骤吗?
-
swift 和 Objective-C 类是否在同一个目标中?
标签: ios xcode swift2 swift3 xcode7