【问题标题】:Using CocoaPods with frameworks and static libraries at the same time同时使用带有框架和静态库的 CocoaPods
【发布时间】:2015-07-18 10:23:44
【问题描述】:

我的项目中有这个 Podfile

platform :ios, '8.0'
use_frameworks!

target 'FunnyApp' do
  pod 'Alamofire', '~> 1.2'
  pod 'SWXMLHash', '~> 1.0'
  pod 'VaultKit', :path => './Frameworks/VaultKit'
  pod 'SessionKit', :path => './Frameworks/SessionKit'
end

只有 VaultKit 是用 Objective-C 编写的静态库。它有这个 podspec:

Pod::Spec.new do |s|
  s.name = 'VaultKit'
  s.version = '0.1'
  s.license = 'MIT'
  s.summary = 'Encryption library'
  s.homepage = 'https://someurl.com'
  s.social_media_url = 'http://twitter.com/greenfish29'
  s.authors = { 'Tomas Sliz' => 'greenfish29@email.com' }
  s.source = { :git => 'git@github.org:greenfish29/vaultkit.git' }

  s.ios.deployment_target = '8.0'

  s.public_header_files = 'VaultKit/VaultKit.h'
  s.source_files = "VaultKit/*.{h,m}" "VaultKit/Models/*.{h,m}"

  s.requires_arc = true
end

我的项目中也有这个记录的桥接头:

#import <VaultKit/VaultKit.h>

但是当我尝试构建项目时,我得到了这个错误:

FunnyApp-Bridging-Header.h:5:9:找不到“VaultKit.h”文件

可能有什么问题?

【问题讨论】:

    标签: ios swift frameworks static-libraries cocoapods


    【解决方案1】:

    Cocoapods 不支持框架和静态库,他们也没有打算这样做。

    查看讨论here

    我最终通过使用桥接头为我的项目使用了仅限 Obj-C 的库,因为我不能没有的重要库只有一个 Obj-C 版本。

    我认为我们至少可以在未来获得对使用静态库作为依赖的动态框架的支持。

    【讨论】:

      猜你喜欢
      • 2023-03-07
      • 2015-09-17
      • 1970-01-01
      • 2020-07-05
      • 1970-01-01
      • 1970-01-01
      • 2017-09-22
      • 1970-01-01
      • 2014-09-18
      相关资源
      最近更新 更多