CocoaPods:添加 AFNetworking 的一半依赖
CocoaPods: Adding half dependency of AFNetworking
我已经制作了自己的私有 Cocoapods。在某些时候它必须访问网络,所以我在我的Cocoapods中添加了AFNetworking
的依赖如下
s.dependency 'AFNetworking', '~> 2.3'
AFNetworking 有 5 个 subspecs
,它们如下:
'Reachability', 'Serialization', 'Security', 'NSURLSession' 'UIKit'
.
我不需要 UIKit。如何仅添加其他四个子规格作为依赖项。
以下是我的 Pod 文件:
Pod::Spec.new do |s|
s.name = 'MyPrivatePod'
s.version = '0.1.6'
s.summary = 'MyPrivatePod is an SDK used for processing a heavy task in the project.'
s.description = "MyPrivatePod provides extensive features while doing private processing. This is private pod and desription is private to"
s.homepage = 'https://path/to/my/priavate/pod/git/_git/MyPrivatePodPodSpecs_iOS'
s.license = { :type => 'Private', :file => 'LICENSE' }
s.author = { 'asifhabib' => 'asif.habib11@gmail.com' }
s.source = { :git => 'https://path/to/my/priavate/pod/git/_git/MyPrivatePodPodSpecs_iOS', :tag => s.version.to_s }
s.ios.deployment_target = '11.0'
s.source_files = 'MyPrivatePod/Classes/**/*.{h,m,swift}'
s.resources = 'MyPrivatePod/Classes/**/*.{storyboard,xib,xcassets}'
s.resource_bundles = {
'MyPrivatePod' => ['MyPrivatePod/Classes/**/*.{storyboard,xib,xcassets}']
}
s.info_plist = { 'CFBundleIdentifier' => 'com.cph.MyPrivatePod' }
s.pod_target_xcconfig = { 'PRODUCT_BUNDLE_IDENTIFIER': 'com.cph.MyPrivatePod' }
s.dependency 'MBProgressHUD', '~> 1.2.0'
s.dependency 'Toast-Swift', '~> 5.0.1'
s.dependency 'AFNetworking', '~> 2.3'
s.swift_version = "4.2"
end
您可以在 podspec 文件中这样定义它。
s.dependency 'AFNetworking/Serialization'
s.dependency 'AFNetworking/Security'
s.dependency 'AFNetworking/Reachability'
或如果你想指定版本
s.dependency 'AFNetworking/Serialization', '~> 3.2.1'
s.dependency 'AFNetworking/Security', '~> 3.2.1'
s.dependency 'AFNetworking/Reachability', '~> 3.2.1'
我已经制作了自己的私有 Cocoapods。在某些时候它必须访问网络,所以我在我的Cocoapods中添加了AFNetworking
的依赖如下
s.dependency 'AFNetworking', '~> 2.3'
AFNetworking 有 5 个 subspecs
,它们如下:
'Reachability', 'Serialization', 'Security', 'NSURLSession' 'UIKit'
.
我不需要 UIKit。如何仅添加其他四个子规格作为依赖项。
以下是我的 Pod 文件:
Pod::Spec.new do |s|
s.name = 'MyPrivatePod'
s.version = '0.1.6'
s.summary = 'MyPrivatePod is an SDK used for processing a heavy task in the project.'
s.description = "MyPrivatePod provides extensive features while doing private processing. This is private pod and desription is private to"
s.homepage = 'https://path/to/my/priavate/pod/git/_git/MyPrivatePodPodSpecs_iOS'
s.license = { :type => 'Private', :file => 'LICENSE' }
s.author = { 'asifhabib' => 'asif.habib11@gmail.com' }
s.source = { :git => 'https://path/to/my/priavate/pod/git/_git/MyPrivatePodPodSpecs_iOS', :tag => s.version.to_s }
s.ios.deployment_target = '11.0'
s.source_files = 'MyPrivatePod/Classes/**/*.{h,m,swift}'
s.resources = 'MyPrivatePod/Classes/**/*.{storyboard,xib,xcassets}'
s.resource_bundles = {
'MyPrivatePod' => ['MyPrivatePod/Classes/**/*.{storyboard,xib,xcassets}']
}
s.info_plist = { 'CFBundleIdentifier' => 'com.cph.MyPrivatePod' }
s.pod_target_xcconfig = { 'PRODUCT_BUNDLE_IDENTIFIER': 'com.cph.MyPrivatePod' }
s.dependency 'MBProgressHUD', '~> 1.2.0'
s.dependency 'Toast-Swift', '~> 5.0.1'
s.dependency 'AFNetworking', '~> 2.3'
s.swift_version = "4.2"
end
您可以在 podspec 文件中这样定义它。
s.dependency 'AFNetworking/Serialization'
s.dependency 'AFNetworking/Security'
s.dependency 'AFNetworking/Reachability'
或如果你想指定版本
s.dependency 'AFNetworking/Serialization', '~> 3.2.1'
s.dependency 'AFNetworking/Security', '~> 3.2.1'
s.dependency 'AFNetworking/Reachability', '~> 3.2.1'