通过迦太基添加 MailCore2 Swift 支持 Xcode

Adding MailCore2 via Carthage with Swift Support to Xcode

在这里尽我所能:

新建项目->OS X->应用程序->语言(Swift)名称(MailCoreTest) 关闭项目 将 Cartfile 添加到项目的根目录,其中包含一行:github "MailCore/mailcore2" 运行 从项目根目录更新 carthage --platform macosx 收到几个警告但没有真正的问题:

/Users/theuser/Documents/XCode/MailCoreTest/Carthage/Checkouts/mailcore2/src/async/imap/MCIMAPAsyncSession.cpp:793:66: warning: 'gmailUserDisplayName' is deprecated [-Wdeprecated-declarations]
/Users/theuser/Documents/XCode/MailCoreTest/Carthage/Checkouts/mailcore2/src/async/imap/MCIMAPAsyncSession.cpp:793:66: warning: 'gmailUserDisplayName' is deprecated [-Wdeprecated-declarations]

在Xcode中再次打开项目 在应用程序目标的“常规”设置选项卡上,在“嵌入式​​二进制文件”部分,我拖放了 Carthage 构建的 MailCore.framework。 我还将 dSYM 添加到产品目录复制文件阶段 在这个阶段,应用程序构建成功,但是当我添加:

#import <MailCore/MailCore.h>
#import <MailCore/MCOConstants.h>

到 Swift-Bridging-Header.h 文件并将其添加到 Objective-C Bridging Header Build Setting 我收到大量构建错误:

MailCoreTest Group
/Users/theuser/Documents/XCode/MailCoreTest/Carthage/Build/Mac/MailCore.framework/Headers/MCIndexSet.h
/Users/theuser/Documents/XCode/MailCoreTest/Carthage/Build/Mac/MailCore.framework/Headers/MCIndexSet.h:15:10: Include of non-modular header inside framework module 'MailCore.MCIndexSet'
/Users/theuser/Documents/XCode/MailCoreTest/<module-includes>
/Users/theuser/Documents/XCode/MailCoreTest/<module-includes>:1:1: Umbrella header for module 'MailCore' does not include header 'MCIMAPConnectOperation.h'
/Users/theuser/Documents/XCode/MailCoreTest/<module-includes>:1:1: Umbrella header for module 'MailCore' does not include header 'MCIMAPNoopOperation.h'
/Users/theuser/Documents/XCode/MailCoreTest/<module-includes>:1:1: Umbrella header for module 'MailCore' does not include header 'MCMainThread.h'
/Users/theuser/Documents/XCode/MailCoreTest/<module-includes>:1:1: Umbrella header for module 'MailCore' does not include header 'MCMXRecordResolverOperation.h'
/Users/theuser/Documents/XCode/MailCoreTest/<module-includes>:1:1: Umbrella header for module 'MailCore' does not include header 'MCNNTPCheckAccountOperation.h'
/Users/theuser/Documents/XCode/MailCoreTest/<module-includes>:1:1: Umbrella header for module 'MailCore' does not include header 'MCONNTPDisconnectOperation.h'
/Users/theuser/Documents/XCode/MailCoreTest/<module-includes>:1:1: Umbrella header for module 'MailCore' does not include header 'MCOPOPNoopOperation.h'
/Users/theuser/Documents/XCode/MailCoreTest/<module-includes>:1:1: Umbrella header for module 'MailCore' does not include header 'MCOSMTPLoginOperation.h'
/Users/theuser/Documents/XCode/MailCoreTest/<module-includes>:1:1: Umbrella header for module 'MailCore' does not include header 'MCPOPNoopOperation.h'
/Users/theuser/Documents/XCode/MailCoreTest/<module-includes>:1:1: Umbrella header for module 'MailCore' does not include header 'MCSizeFormatter.h'
/Users/theuser/Documents/XCode/MailCoreTest/<module-includes>:1:1: Umbrella header for module 'MailCore' does not include header 'MCSMTPNoopOperation.h'
/Users/theuser/Documents/XCode/MailCoreTest/MailCoreTest/Swift-Bridging-Header.h
/Users/theuser/Documents/XCode/MailCoreTest/MailCoreTest/Swift-Bridging-Header.h:12:9: Could not build module 'MailCore'
Failed to import bridging header '/Users/theuser/Documents/XCode/MailCoreTest/MailCoreTest/Swift-Bridging-Header.h'

奇怪的是我在另一个项目中使用它。我什至可以 运行 carthage update against it and nothing breaks.在尝试重现一个有效的新项目数小时后,我似乎无法让它工作。我一定是遗漏了什么,但我不知道它是什么,甚至不知道去哪里找。

只是在测试中,我在 "Target" 下尝试构建设置并将 "Allow Non-modular Includes in Framework Modules" 设置为 YES 但得到相同的结果 - 在另一个工作项目中我将其设置为 NO.

Carthage 需要检查最新的提交。将 Cartfile 更改为:

github "MailCore/mailcore2" "master"

变魔术