why xcodebuild
building the same application differently for scheme
and target
options?
xcodebuild -target uConnect build
Above commands builds with Release config in build folder inside
project.
xcodebuild -scheme uConnect build
Above builds with Debug config in Xcode’s DrivedData folder.
Wanted to understand what difference -target and -scheme options are making here?
As per my understanding it should always build the application in Release mode since we have selected Release at Project>>Info>>Configuration
use
Release
for command-line builds
Reference:
2
Answers
Try editing the scheme. You will see that it specifies the Debug configuration when building. It might look like this:
But, as you’ve said, when you build the target, you’ve specified the Release configuration.
A target describes a product that Xcode will build, like your app, the tests, an App Clip or an Extension. When using
-target
, it will use the configuration specified in the drop down at the bottom of your screenshot.A scheme is a configuration that describes how a specific target will be built under different circumstances. If you go to the scheme editor, you’ll see that you can choose which configuration to build when running, testing, profiling, analyzing, and archiving.