Why does xcodebuild give different build results than XCode UI

耗尽温柔 提交于 2019-12-10 15:57:13

问题


I have a series of projects within a workspace, and trying to use the following type of command to build them via the command line:

"Xcodebuild -project XXX"
or 
"Xcodebuild -workspace XXX -scheme YYY"

Some of my projects build fine but others give strange errors, like "'XXX' for instance message does not declare a method with selector" or "ld: library not found for -lMyLibrary"

However all these projects build fine from within the XCode UI without issues.

Based on this is seems that the command line and UI builds are using a different toolset, but that seems like a very bad idea so I'm hoping I'm wrong about this. Or possibly there are just a few different build flags being set on the command line build.

I can try to troubleshoot the issues one by one but I'm hoping I can write a script which does the exact same type of build as the UI.

Any ideas?


回答1:


Without including -configuration, xcodebuild is going to use the default configuration for each project. Generally that's Release. In Xcode, the Configuration you select will be applied to every project regardless of default.

Given your errors, your most likely problem is that you've used the build pane (why I hate the build pane for large projects), and you've made the classic mistake of applying some settings for Debug rather than all configurations.



来源:https://stackoverflow.com/questions/10653065/why-does-xcodebuild-give-different-build-results-than-xcode-ui

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