是否可以向.podspec文件添加本地依赖项? [英] Is it possible to add a local dependency to .podspec file?
问题描述
我现在正在使用cocoapods,我想在我的项目中添加本地pod依赖项,例如:
I'm using cocoapods now I would like to add a local pod dependency in my project, something like:
s.dependency = 'my pod', :path => ''
但是我认为这不可能,有些想法吗?
but I think is not possibile, some ideas?
推荐答案
我遇到了同样的问题,经过大量的搜索并在CocoaPods github上提问后,我终于找到了合适的答案。
I have faced with the same issue and after lot of googling and asking on the CocoaPods github I have finally found the suitable answer.
不可能将本地pod设置为依赖项,但是可以为特定Podfile设置pod的源,这将以相同的方式进行。
It's not possible to set a local pod as a dependency, but it's possible to set a pod's source for a specific Podfile, which will work the same way.
例如,在您的podspec中,您仍然有()
E.g., in your podspec, you still have ()
s.dependency = 'my pod', '~> 1.0' # or whatever version you have
的任何版本
然后在您的示例/演示/测试项目的Podfile中:
Then in your Example/demo/test project's Podfile:
pod 'my pod', :path => '/path/to/the/local/my_pod'
然后只需运行吊舱安装
,您将把这两个吊舱都视为开发吊舱。
Then just run pod install
and you will see both pods as a Development pods.
这种方式在开发2个吊舱(其中一个吊舱)时非常有用(这是彼此依赖的),但是要发布,您仍然必须将Pod发布到仓库(CocoaPods或私人仓库)。
This way is very useful when you're developing 2 pods (one of which is dependend on the other) simultaneously, yet for release you will still have to publish your pod to the repo (either CocoaPods or a private repo).
这篇关于是否可以向.podspec文件添加本地依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!