Xcode - 使用相对路径而不是框架搜索路径的直接路径
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21342032/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode - use relative paths instead of direct path for Framework Search Paths
提问by soleil
When I add a framework in Xcode (5) it creates this beast of a path:
当我在 Xcode (5) 中添加一个框架时,它会创建一个路径的野兽:
/Users/me/MyApp\ Subfolder1\ Subfolder2/MyApp\ Subfolder1\ Subfolder2/libraries/third-party-lib-2.0
How to I turn this direct path into a relative one so that it works wherever the project is opened?
如何将这个直接路径转换为相对路径,以便它在项目打开的任何地方都能工作?
回答by Jesly Varghese
You can use $(SRCROOT)if you want to refer paths relative to your source directory. Refer this from apple docs. There are bunch of these kind of variables. But in Build settings they will be shown as expanded, once you open it for editing it will resort it to the relative path variable.
如果要引用相对于源目录的路径,可以使用$(SRCROOT)。参考苹果文档。有很多这样的变量。但是在构建设置中,它们将显示为展开状态,一旦您打开它进行编辑,它将使用相对路径变量。
Between if you are adding frameworks to your project, will be good if you consider using CocoaPods. Framework/package management will be a piece of cake with it. And the learning curve is also quite smooth.(I don't think if there is a learning curve at all)
如果您要向项目添加框架,则考虑使用CocoaPods会很好。框架/包管理将是小菜一碟。而且学习曲线也相当平滑。(我觉得根本没有学习曲线)