您好,我正在为我的私有(private)库创建 podspec,效果很好,但是当我创建带有子规范的 podspec 时,使用 $ pod spec lint [podname].podspec 进行验证将会成功
但是当我添加这个 pod 并说 $ pod install
我总是收到这个错误:
错误
ArgumentError - Malformed version number string Loader
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-0.32.1/lib/cocoapods-core/vendor/version.rb:191:in `initialize'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-0.32.1/lib/cocoapods-core/version.rb:60:in `initialize'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-0.32.1/lib/cocoapods-core/source/file_system_data_provider.rb:61:in `new'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-0.32.1/lib/cocoapods-core/source/file_system_data_provider.rb:61:in `block in versions'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-0.32.1/lib/cocoapods-core/source/file_system_data_provider.rb:59:in `map'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-0.32.1/lib/cocoapods-core/source/file_system_data_provider.rb:59:in `versions'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-0.32.1/lib/cocoapods-core/source.rb:90:in `versions'
我的 podspec 看起来像这样:
sp.dependency 'Globals','~> 0.0.1' 和 sp.dependency 'Extensions','~> 0.0.1' 是私有(private) Pod,它们可以正常工作。
Pod::Spec.new do |s|
s.name = "Networking"
s.version = "0.0.2"
s.summary = "Networking for Handling Network"
s.description = "Networking handling Network and blabla"
s.homepage = "http://www.myhp.at"
# ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
s.license = { :type => 'MIT', :text => <<-LICENSE
Copyright 2014 blabla
LICENSE
}
# ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
s.author = { "MyName" => "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7a171f3a171f541b0e" rel="noreferrer noopener nofollow">[email protected]</a>" }
# ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
s.platform = :ios, "5.0"
# ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
s.source = { :git => "https://myurl/myrepo.git", :tag => "0.0.2" }
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
# s.source_files = "Networking/"
# s.exclude_files = "Classes/Exclude"
# s.public_header_files = "Classes/**/*.h"
s.subspec 'Loader' do |sp|
sp.source_files = 'Networking/Loader'
sp.dependency 'ASIHTTPRequest', '~> 1.8'
sp.dependency 'Globals','~> 0.0.1'
sp.dependency 'Extensions','~> 0.0.1'
end
s.subspec 'L1DataFeed' do |sp|
sp.source_files = 'Networking/DataFeed'
sp.frameworks = 'CoreData'
sp.dependency 'ASIHTTPRequest', '~> 1.8'
sp.dependency 'Globals','~> 0.0.1'
sp.dependency 'Extensions','~> 0.0.1'
end
s.subspec 'L1NetworkManager' do |sp|
sp.source_files = 'Networking/NetworkManager'
sp.dependency 'Networking/DataFeed'
sp.dependency 'ASIHTTPRequest', '~> 1.8'
sp.dependency 'Globals','~> 0.0.1'
sp.dependency 'Extensions','~> 0.0.1'
end
# ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
# s.resource = "icon.png"
# s.resources = "Resources/*.png"
# s.preserve_paths = "FilesToSave", "MoreFilesToSave"
# ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
# s.framework = "SomeFramework"
# s.frameworks = "SomeFramework", "AnotherFramework"
# s.library = "iconv"
# s.libraries = "iconv", "xml2"
# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
s.requires_arc = true
# s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
#s.dependency 'ASIHTTPRequest', '~> 1.8', '>= 1.8.2'
#s.dependency 'Globals','~> 0.0.1'
#s.dependency 'Extensions','~> 0.0.1'
end
文件夹结构如下所示:
根:
- 网络
- --> 加载器
- --> 数据馈送
- --> 网络管理器
有人可以帮我解决这个问题吗?
我尝试制作另一个具有子规范相同问题的 podspec。
最佳答案
异常回溯似乎表明从磁盘读取规范时会发生这种情况。是否您的规范目录中有一个 Loader
目录,该目录通常应包含版本目录?
例如这仅包含版本目录:
$ ls -l ~/.cocoapods/repos/master/AFNetworking/
drwxr-xr-x 3 eloy 员工 102 2 月 2 日 14:14 2.0.0
drwxr-xr-x 3 eloy 员工 102 2 月 2 日 14:14 2.0.0-RC1
drwxr-xr-x 3 eloy 员工 102 2 月 2 日 14:14 2.0.0-RC2
drwxr-xr-x 3 eloy 员工 102 2 月 2 日 14:14 2.0.0-RC3
drwxr-xr-x 3 eloy 员工 102 2 月 2 日 14:14 2.0.1
drwxr-xr-x 3 eloy 员工 102 2 月 2 日 14:14 2.0.2
drwxr-xr-x 3 eloy 员工 102 2 月 2 日 14:14 2.0.3
drwxr-xr-x 3 eloy 员工 102 2 月 2 日 14:14 2.1.0
drwxr-xr-x 3 eloy 员工 102 3 月 3 日 17:42 2.2.0
drwxr-xr-x 3 eloy 员工 102 三月 15 13:05 2.2.1
drwxr-xr-x 3 eloy 员工 102 四月 16 13:33 2.2.2
关于objective-c - Cocoapods 安装具有 subspec 的 pod 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23270266/