查找 Xcode 项目的 ${PROJECT_DIR}
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8888803/
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
Find the ${PROJECT_DIR} for an Xcode project
提问by adit
How do I figure out what my absolute ${PROJECT_DIR}
path is for my Xcode project? Is there a way to print this in Terminal? How?
我如何${PROJECT_DIR}
确定我的 Xcode 项目的绝对路径是什么?有没有办法在终端中打印这个?如何?
回答by vk.edward.li
Build Settings -> Preprocess Macros
构建设置 -> 预处理宏
PROJECT_DIR=@\""$PROJECT_DIR"\"
BUILD_ROOT=@\""$(BUILD_ROOT)"\"
Then you can log it directly
然后就可以直接登录了
NSLog(@"project dir=%@, BUILD_ROOT_=%@", PROJECT_DIR, BUILD_ROOT);
回答by Xavi Gil
Run this from Terminal
从终端运行这个
For a project:
对于一个项目:
xcodebuild -project yourProject.xcodeproj -target yourTarget -showBuildSettings | grep PROJECT_DIR
For a workspace:
对于工作区:
xcodebuild -workspace yourWorkspace.xcworkspace -scheme yourScheme -showBuildSettings | grep PROJECT_DIR
As you can see, you can retrieve any other build settings value
如您所见,您可以检索任何其他构建设置值