我正在尝试创建一个名为的自定义框架CouchbaseKit
(Xcode 中的新目标)在 Swift 中。在我的里面CouchbaseKit
,我需要访问CouchBaseLite Framework
这完全写在Obj-C。我在用着Cocoapods
管理CouchBaseLite
以及其他一些框架。下面是我的 podfile。
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:
For my TARGETS我在构建阶段有以下设置。
定义模块 Yes
允许框架模块中包含非模块化内容 Yes
Problem:当我尝试访问 CouchbaseKit(我的自定义框架)内的 CouchbaseLite 框架时,出现错误:“不存在这样的模块‘CouchbaseLite’。
Tried:
由于该项目是用 Swift 编写的,我创建了一个 Objective-C 文件并点击“yes”您想配置 Objective-C 桥接头吗?"
Even though Allow Non-modular Includes in Framework Modules is set to YES in all targets, I still get an error when I try to #import <CouchbaseLite/CouchbaseLite.h>
in CouchbaseKit.h
这是我的自定义框架的构建阶段CouchbaseKit
问题:如何在我的自定义 Swift 框架中查看外部 Objective-C 框架 (CouchasebaseLite)?
iOS 上的 CouchbaseLite 是一个静态框架,即它的二进制文件是一个静态库而不是 dylib。这意味着它会像源文件一样链接到您的应用程序中。因此你不使用import
在 Swift 中访问它;这些类已经与您的应用程序的类位于同一名称空间中。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)