ios - 使用一个目标中的框架作为本地另一目标中的 Pod

标签 ios objective-c frameworks cocoapods

我在使用我在其他目标(同一项目)中使用模块化导入编写的框架时遇到问题。我正在使用 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/

相关文章:

ios - dyld:库未加载Xcode11

Java Web 应用程序框架,用于处理需要长时间计算的进程的客户端回调

ios - Swift - 更新/刷新显示时间的标签

iphone - 在 iPhone 上使用 Phonegap 条码扫描器

java - 将 main() 添加到 Java 类时出现问题

ios - 将变量传递给 decimalNumberHandlerWithRoundingMode?

ios - iOS 7 中的 UISwitch 显示边框

用于 URL Scheme 测试的 iOS 模拟器 WebApp/书签

ios - 使用应用组在应用之间通信和保存数据

ios - EXC_BAD_ACCESS 与 ARC 使用 KZColorPicker