我正在尝试创建一个名为 CouchbaseKit
的自定义框架(Xcode 中的一个新目标)在 Swift 中。在我的CouchbaseKit
,我需要访问CouchBaseLite Framework
完全写在 对象-C .我正在使用 Cocoapods
管理CouchBaseLite
和其他几个框架。下面是我的 podfile。
播客文件
# Uncomment this line to define a global platform for your project
link_with ['CouchbaseKit']
# platform :ios, '8.0'
use_frameworks!
target 'CouchbaseDB' do
link_with ['CouchbaseKit']
pod 'couchbase-lite-ios'
pod 'SwiftyJSON', '~> 2.2.0'
pod 'Alamofire', '~> 1.2'
pod 'XCGLogger', '~> 2.0'
end
target 'CouchbaseDBTests' do
end
target 'CouchbaseKit' do
end
target 'CouchbaseKitTests' do
end
项目内的 Pod:
对于我的目标 我在构建阶段有以下设置。
定义模块是的
允许框架模块中的非模块化包含 是的
问题:
当我尝试访问我的 CouchbaseKit(我的自定义框架)中的 CouchbaseLite 框架时,我收到一个错误,“没有这样的模块 'CouchbaseLite' 不存在。
试过:
#import <CouchbaseLite/CouchbaseLite.h>
时仍然出现错误。在 CouchbaseKit.h
这是我的自定义框架的构建阶段的样子
CouchbaseKit
问题:如何在我的自定义 Swift 框架中查看外部 Objective-C 框架 (CouchasebaseLite)?
最佳答案
如果您仍然想使用 Cocoapods,可以关注 this
脚步:
那个案例
CouchbaseLite
并在其中创建模块图。文件名将是 module.map
其内容为模块 CouchbaseLite {
标题“../Pods/couchbase-lite-ios/CouchbaseLite.framework/Headers/CouchbaseLite.h”
导出 *
}
Important Note: Don't add that folder to the project, I don't know why not when done it will not work
..
更新:
它可以在 Xcode 中很好地工作,但是当我尝试使用
pod lint
验证 pod 时它仍然给出错误,我仍然不知道为什么。
关于iOS8:自定义 Swift 框架访问用 Objective-C 编写的外部框架,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31688348/