我试图创建一个依赖于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安装时,我收到以下错误:
[!] 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!
运行它。