Obj-C CocoaPods + Swift框架 [英] Obj-C CocoaPods + Swift Framework
问题描述
我正在最新的Xcode 6 DP4中创建一个Swift框架。我需要在框架中内部使用AFNetworking,但无法找到一种编译方法。
I'm creating a Swift framework in the latest Xcode 6 DP4. I need to internally use AFNetworking in my framework, but can't figure out a way to compile it.
我知道如何使用桥接头,但是Swift框架不支持这些头。
I know how to use bridging headers, but those aren't supported in Swift frameworks.
我的框架Core.framework看起来像这样:
My framework, Core.framework, looks like this:
> Core.h
#import <UIKit/UIKit.h>
#import <AFNetworking/AFNetworking.h>
//! Project version number for Core.
FOUNDATION_EXPORT double CoreVersionNumber;
//! Project version string for Core.
FOUNDATION_EXPORT const unsigned char CoreVersionString[];
> SomeFileThatNeedsAFNetworking.swift
我正在使用podfile引入AFNetworking。但是,当我编译时,出现以下错误:
And I'm using a podfile to bring in AFNetworking. However, when I compile, I get the following error:
<unknown>:0: error: ~/Core/Source/Core.h:2: include of non-modular header inside framework module 'Core'
AFNetworking导入。但是,如果不包括在内,那么在引用AFNetworking的地方都会出现编译错误。
because of the AFNetworking import. But if I don't include that, then I get compilation errors everywhere referencing AFNetworking.
有人能找到正确的组合吗?
Has anyone figured out the right combination?
推荐答案
好吧,根据我所看到的这里和这里,我认为无法编译荚文件中的任何内容。我尝试使用SCLAlertView-Swift库执行此操作,但出现类似错误。我认为您只需要等待cocoapods团队开发代码即可。
Well, based on what I'm seeing here and here I don't think it is possible to compile anything from a pod file just yet. I have tried to do this with the SCLAlertView-Swift library with similar errors. I think you will just have to wait for the code to get developed by the cocoapods team.
这篇关于Obj-C CocoaPods + Swift框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!