我在使用我在其他目标(同一项目)中使用模块化导入编写的框架时遇到问题。我正在使用 Cocoapods。我在尝试使用模块化导入 (@import CMPComapiFoundation;) 导入模块时遇到 无法构建模块: 错误。我附上repo的链接了解更多信息。
我确实尝试了本地(:path =>)和远程(:git =>)方法将SDK拉到Podfile中,但似乎都不起作用。值得注意的是,如果通过 Cocoapods 添加到单独的项目中,则可以编译代码并导入 SDK。
SDK 的 .podspec 文件:
Pod::Spec.new do |s|
s.name = 'CMPComapiFoundation'
s.version = '1.2.2'
s.license = 'MIT'
s.summary = 'Foundation library for connecting to and consuming COMAPI services'
s.description = <<-DESC
# iOS SDK for Comapi
Client to connect your iOS application with [Comapi](http://comapi.com/) services and add it as a channel to our cloud messaging platform. Written in Objective-C.
For more information about the integration please visit [the website](http://docs.comapi.com/reference#one-sdk-ios).
DESC
s.homepage = 'https://github.com/comapi/comapi-sdk-ios-objc'
s.author = { 'Comapi' => 'support@comapi.com' }
s.source = { :git => 'https://github.com/comapi/comapi-sdk-ios-objc.git', :tag => s.version.to_s }
s.social_media_url = 'https://twitter.com/comapimessaging'
s.ios.deployment_target = '10.0'
s.requires_arc = true
s.source_files = 'Sources/**/*.{h,m}'
s.resources = []
s.dependency 'SocketRocket'
end
这是我在整个项目中使用的 Podfile:
platform :ios, '10.0'
use_frameworks!
def shared
pod 'CMPComapiFoundation', :path => '/Users/dominik.kowalski/Documents/comapi-sdk-ios-objc'
pod 'JWT'
end
target 'CMPComapiFoundation' do
pod 'SocketRocket'
end
target 'CMPComapiFoundationTests' do
shared
end
target 'ComapiFoundationSample' do
shared
end
target 'ComapiFoundationSample-Swift' do
shared
pod 'SnapKit'
end
我希望测试和示例目标导入模块并编译代码。
最佳答案
好的,我自己解决了。一些头文件缺少 Target 成员资格,但 Xcode 给了我误导性的提示。
关于ios - 使用一个目标中的框架作为本地另一目标中的 Pod,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56956166/