Ios 在构建Cocoapod时,是否有方法指定对另一个分支的依赖关系?
我正在尝试构建一个Cocoapod(目前,当iOS9和Xcode7脱离测试版时,这种情况将会改变),它依赖于Alamofire和SwiftyJSON的不同分支。这是因为我的Cocoapod是用Swift 2.0编码的。更具体地说,我的pod当前依赖于Ios 在构建Cocoapod时,是否有方法指定对另一个分支的依赖关系?,ios,swift,cocoapods,dependency-management,Ios,Swift,Cocoapods,Dependency Management,我正在尝试构建一个Cocoapod(目前,当iOS9和Xcode7脱离测试版时,这种情况将会改变),它依赖于Alamofire和SwiftyJSON的不同分支。这是因为我的Cocoapod是用Swift 2.0编码的。更具体地说,我的pod当前依赖于swift2-0Alamofire分支和xcode7SwiftyJSON分支 我的Podspecs文件当前如下所示: # # Be sure to run `pod lib lint ALSMAL.podspec' to ensure this is
swift2-0
Alamofire分支和xcode7
SwiftyJSON分支
我的Podspecs文件当前如下所示:
#
# Be sure to run `pod lib lint ALSMAL.podspec' to ensure this is a
# valid spec and remove all comments before submitting the spec.
#
# Any lines starting with a # are optional, but encouraged
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = "ALSMAL"
s.version = "2.0.0"
s.summary = "A Swift wrapper for the Atarashii MAL API."
s.description = <<-DESC
A Swift, protocol-oriented iOS framework to interact with Atarashii MAL API, an unofficial API for MyAnimeList.net.
DESC
#s.homepage = "https://github.com/AndyIbanez/ALSMAL"
s.homepage = "https://andyibanez.com"
s.license = {:type => "MIT", :file => "LICENSE"}
s.author = { "Andy Ibanez" => "andy@andyibanez.com" }
s.source = { :git => "https://AndyIbanez@bitbucket.org/AndyIbanez/alsmal.git", :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/AndyIbanezK'
s.platform = :ios, '9.0'
s.requires_arc = true
s.source_files = 'ALSMAL/*'
s.resource_bundles = {
'ALSMAL' => ['Pod/Assets/*.png']
}
s.dependency 'Alamofire'
s.dependency 'SwiftyJSON'
end
然后,因为我的项目使用的是iOS 9/Xcode 7技术,所以我将Xcode的命令行工具更改为使用Xcode 7 beta(Xcode>首选项>位置>将“命令行工具”设置为Xcode 7),并尝试将其删除。它失败了:
- ERROR | Alamofire/Source/Request.swift:76:30: error: '#' has been removed from Swift; double up 'user user' to make the argument label the same as the parameter name
(它抛出了更多错误,但所有这些错误都与从Swift 1.0/1.2到Swift 2.0的变化有关)
当然,这只意味着Cocoapods正在下载Alamofire依赖项的官方分支,因为Swift 2.0有效地删除了用于创建同名函数参数标签和变量的
语法。swift2-0
分支解决了这个问题
如果我运行我的单元测试,它们都可以正常编译和运行,因此CoCoapod会使用我的依赖项的主分支版本,而不是我在Podfile中明确定义的版本
有什么方法可以为我的pod设置不同的分支依赖项吗?这将只是暂时使用,因为我想开始构建我的iOS 9应用程序,并在真实案例中测试我的pod。一旦Xcode 7退出测试版,我在pod中使用的分支很可能会与它们各自的主节点合并,我就不必再寻找变通方法来让它们工作了。我在中询问过,其中一位贡献者回答了我的问题
Linting(因此,尝试上载pod)在Podspec上运行,而不是在Podfile上运行,并且无法在Podspec中指定不同的分支
否,只能在Podfile中设置未发布的依赖项
因此,遗憾的是,我想做的是不可能
- ERROR | Alamofire/Source/Request.swift:76:30: error: '#' has been removed from Swift; double up 'user user' to make the argument label the same as the parameter name