Podspec 对 OpenSSL 的依赖

问题描述 投票:0回答:1

我正在尝试创建一个依赖于 OpenSSL-Universal 的 Pod。我遇到了一些麻烦,因此作为参考,我查找了具有此类依赖项的其他 pod,并找到了 CoreBitcoin:https://github.com/oleganza/CoreBitcoin

在 CoreBitcoin.podspec 中,它清楚地写着:

s.dependency 'OpenSSL-Universal', '1.0.1.j-2'

现在,我也尝试包含相同的依赖项,转到自动生成的示例文件夹,然后运行 pod install。这是我自动生成的 Podfile 的样子,除了项目名称替换和 OpenSSL 依赖项之外:

#
# Be sure to run `pod lib lint <ProjectName>.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#

Pod::Spec.new do |s|
  s.name             = "<ProjectName>"
  s.version          = "0.1.0"
  s.summary          = "A short description of <ProjectName>."

# This description is used to generate tags and improve search results.
#   * Think: What does it do? Why did you write it? What is the focus?
#   * Try to keep it short, snappy and to the point.
#   * Write the description between the DESC delimiters below.
#   * Finally, don't worry about the indent, CocoaPods strips it!  
  s.description      = <<-DESC
                       DESC

  s.homepage         = "https://github.com/<GITHUB_USERNAME>/<ProjectName>"
  # s.screenshots     = "www.example.com/screenshots_1", "www.example.com/screenshots_2"
  s.license          = 'MIT'
  s.author           = { "<name>" => "<email>" }
  s.source           = { :git => "https://github.com/<GITHUB_USERNAME>/<ProjectName>.git", :tag => s.version.to_s }


  s.platform     = :ios, '8.0'
  s.requires_arc = true

  s.source_files = 'Pod/Classes/**/*'
  s.resource_bundles = {
    '<ProjectName>' => ['Pod/Assets/*.png']
  }

  # s.public_header_files = 'Pod/Classes/**/*.h'
  # s.frameworks = 'UIKit', 'MapKit'
  s.dependency 'OpenSSL-Universal', '1.0.1.j-2'
end

但是,当我进入 pod install 时,出现以下错误:

[!] The 'Pods-<ProjectName>_Example' target has transitive dependencies that include static binaries: (/Users/<name>/Developer/<ProjectName>/Example/Pods/OpenSSL-Universal/lib-ios/libcrypto.a and /Users/<name>/Developer/<ProjectName>/Example/Pods/OpenSSL-Universal/lib-ios/libssl.a)

我一直在网上搜索,人们一直说出现此类问题是因为 OpenSSL-Universal 需要静态库。我知道,这不太好,但我需要我的 Pod 能够与 iOS 和 OSX 一起工作,并且以某种方式,CoreBitcoin 已经成功地使用了这种依赖关系,这意味着这是可能的。我做错了什么?

更新:我尝试建立一个全新的项目,它不是 Pod,而只是一个依赖于 CoreBitcoin 的简单项目。运行

pod install
产生了同样的错误,所以我不认为这是 Podspec 的问题。假设 CoreBitcoin 没有做错任何事情,这可能是 Podfile 的问题。我尝试在有和没有
use_frameworks!
的情况下运行它。

ios swift openssl static-libraries cocoapods
1个回答
0
投票

你可以试试这个:

  pod 'CoreBitcoin', :podspec => 'https://raw.github.com/oleganza/CoreBitcoin/master/CoreBitcoin.podspec'

这适用于我的个人项目。 希望它也能帮助其他人。

© www.soinside.com 2019 - 2024. All rights reserved.