在 Swift REPL 中导入用于测试的框架构建失败?

Importing a framework build for testing in Swift REPL fails?

我已经为 macOS 构建了我的框架(混合 Swift 和 Objective-C)及其依赖项 (Alamofire);不会出现编译器错误。构建产品愉快地驻留在 /Users/myuser/Library/Developer/Xcode/DerivedData/myproject-hash/Build/Products/Debug/ 中。该项目最初创建为 Cocoa Touch Framework;我手动添加了一个 macOS 目标(这需要一些争论)。

现在我尝试申请this answer,调用

swift -F /Users/myuser/Library/Developer/Xcode/DerivedData/myproject-hash/Build/Products/Debug/

当我尝试 import Alamofire 时,我遇到了一大堆这样的错误:

error: Alamofire debug map object file '/Users/myuser/Library/Developer/Xcode/DerivedData/myproject-hash/Build/Intermediates/Alamofire.build/Debug/Alamofire macOS.build/Objects-normal/x86_64/Timeline.o' has changed (actual time is 0x58ef7cfd, debug map time is 0x58ef6d81) since this executable was linked, file will be ignored

这令人困惑,因为我只是构建了框架。另外,为什么框架链接到 Intermediates?

最后:

error: Couldn't lookup symbols:
  __swift_FORCE_LOAD_$_swiftCoreGraphics
  __swift_FORCE_LOAD_$_swiftDispatch

如果我在(失败?)import Alamofire.

之后尝试 import MyProject,也会出现此问题

如果我直接 import MyProject(在新会话中),所有 debug map object file... 错误都会发生,但 lookup symbols 不会。当我尝试从 MyProject 实例化一个结构时,我 do 得到 Couldn't lookup symbols 错误,这次是来自 MyProject.[=27= 的符号]

这是怎么回事?我做错了什么,我该如何解决或解决这个问题?

当我使用发布版本时,错误消失了 -- 如果我这样做 import Alamofire; import MyProject。显然依赖项不是递归导入的。

以上是 Swift 3.0.2。我无法用 Swift 3.1.

重现它

注意事项:看来真的很重要

import Alamofire
import MyProject

如果您跳过第一次导入,MyProject 的导入不会失败,但会发生奇怪的查找错误(根本没有提到 Alamofire 的东西)。