自动选择本地CocoaPods框架的正确路径 [英] Automatically select proper path to local CocoaPods framework

查看:811
本文介绍了自动选择本地CocoaPods框架的正确路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个本地框架.由于我在不同的计算机上工作,因此我有不同的本地路径到此框架.因此,每当我在另一台计算机上构建它时-我都需要更改路径.这就是我要更改的方式:

I have a local framework. Since I work from different computers - I have different local paths to this framework. So, whenever I build it on another machine - I need to change the path. That is how I change it:

target 'SomeTarget' do
#    pod 'SomeFramework', :path => 'some/other/local/path'
    pod 'SomeFramework', :path => 'some/local/path'
end

是否有两种写路径的方法,并且会自动选择正确的路径?或其他任何有助于忘记手动每日Podfile更改的解决方案.

Is there some way to write both paths and the proper path will be selected automatically? Or any other solution which will help to forget about manual daily podfile changes.

推荐答案

您可以设置环境变量.对我来说(我使用 zsh ),它是我设置环境变量的根目录中的 .zshrc 文件.

You can set environment variable. For me (I use zsh), it's .zshrc file in my root directory where I set the environment variable.

示例:

.zshrc 文件中,添加下一行:

In .zshrc file add the next line:

export PATH_TO_SOME_FRAMEWORK="some/local/path"

然后,您可以通过以下方式在podfile中使用环境变量:

And after that you can use environment variable in podfile this way:

target 'SomeTarget' do
    pod 'SomeFramework', :path => ENV['PATH_TO_SOME_FRAMEWORK']
end

这篇关于自动选择本地CocoaPods框架的正确路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆