Automatically select proper path to local CocoaPods framework

怎甘沉沦 提交于 2019-12-13 03:45:09

问题


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

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.


回答1:


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

Example:

In .zshrc file add the next line:

export PATH_TO_SOME_FRAMEWORK="some/local/path"

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

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


来源:https://stackoverflow.com/questions/48414821/automatically-select-proper-path-to-local-cocoapods-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!