I have 3 configurations in my project (Debug, Distribution_AdHoc and Distribution_AppStore). In Xcode 3 we had a list to choose device, version, configuration and target before build and run. Now with Xcode 4 we only have the device kind and version in this list. This bring my two questions:
So where is defined the configuration used ? Is that the configuration defined in "Project > Info > Command-line builds use: Debug" ?
And now the "Project" menu is replaced by "Product" So where can we create (or duplicate and edit) a Configuration ?
Thank you.
Just in case you still want to make a Distribution config (or other config--I still find them useful), after great length (read: searched in the help for 'duplicate'), I found this:
At first, they were all grayed out; this was because I had one of the targets highlighted in the editor (MFE, MFETests, etc.). If you highlight your project (as in the screenshot), they become enabled.
You can use alt(option) and click on either, run, test or profile to see the option.
Here you can set the target for each option.
For Archive the release is normally used, since can you resign your app via the organizer there is no need ad-hoc and appstore target any more.
For part 1 of your question,
The configuration is set in the schema window. apple+shift+comma to get to the window. Or Product > Scheme > Manage Schemes from the menu bar.
In the window, click the type of build you want on the left panel: Build, Run, Profile, Analyze, or Archive. In the window tab usually, along the type, there is an option Build Configuration that can be set. Select Debug, Release, or whichever configuration you want there.
The exception if the build task. The build task uses whatever configuration is set for the Run task. Also, the analyze and archive tasks only have one tab, so using the info tab is not necessity.
Apparently, "build" is shorthand for "build for run"...
Related
At first I thought a scheme was a list of values for each build type. By default, there are two schemes, Debug and Release. In the app target, you customize each scheme on the fly by choosing the values (in the default case for either Debug or Release).
However, now I think the schemes are bigger than that. Your project comes with one scheme by default, and included in that scheme is the ability to customize settings for different build types, including run, test profile, etc... So in ONE scheme you can have settings xyz for the run phase, and in ANOTHER shceme you can have settings abc for the run phase.
I'm a little confused here. Can anyone simplify this?
Thanks
From Xcode's Help:
scheme
A scheme is a collection of settings that specify the targets to build for a project, the build configuration to use, and the executable environment to use when the product is launched. When you open an existing project (or create a new one), Xcode automatically creates a scheme for each target. The default scheme is named after your project.
Here, "build configuration" is what you're calling "Debug" and "Release" above.
i get this warning on main storyboard
xcode Version 7.2 (7C68)
warning: You have to install and set up Swift-Clean to use its features!
You (or someone for you) installed Swift-Clean (www.swiftcleanapp.com) into your project and forgot to add the preferences that Swift-Clean needs in order to check your code.
If you want to use Swift-Clean, you need to go to www.swiftcleanapp.com/survey.php, take the survey and download the .plist file that you'll insert into your project. Build the project; Swift-Clean will show you warnings if your code isn't compliant with the rules you specified.
If you want to delete Swift-Clean from your project, simply go to your target preferences (Project navigator > project name > select your target) and go to "Build Phases". You'll find a "Swift-Clean Run Script" Run Script Phase. Delete it by clicking on the "x" on the right side.
Also, to use Swift-Clean as it's automatically configured, the .app bundle needs to be in the Application folder.
When you create a new iOS project you have 2 build variants, Debug and Release (or at least that's what they are called in Android, Build Variant).
Is it possible to create a another build variant? Let's say, "Staging".
Then, how do I run my app on a different build variant, for example how do I run it in release mode on the emulator/development device?
Yes, here's how.
To add a build configuration
In the menu to the left, select your project.
To the right, you'll see "PROJECT" and "TARGETS". Select your project.
Go to the Info tab and click '+' under Configurations and choose "Duplicate "Debug"/"Release" configuration" and name it whatever you'd like.
To choose which build type to use
Click "NameOfMyProject" next to the device you're building to (upper left of the screen) and choose "Edit scheme".
Choose Run -> Build Configuration -> NameOfYourBuildConfiguration.
Hope it helps.
When I add a test target that needs a host application in order to run Xcode adds targets that are not associated with the application I added.
I have two schemes (internal & production). I want to run tests on our internal application. When I add the internal application as a host I end up with the production target being added to builds and cannot delete it. If I remove the host application this goes away but the tests also fail.
Does anyone know where I'm going wrong?
We had the same problems, we fixed them with these steps:
in your testing target, go to the tab 'General' and set the hosting application to 'none', then go to 'Build phases' and remove the target dependency on the former hosting target.
(don't know if this step is necessary) go to 'Window'->'Projects', remove Derived Data from the hosting target and close Xcode. Reopen Xcode again, open your project/workspace.
edit your hosting target's scheme, select "Build" on the left and uncheck "Find Implicit Dependencies" - I believe that this function is somewhat buggy.
in your testing target, go to the tab 'General' and set the hosting application back to its previous value, recheck the target depdencies.
Is there a compile time variable that lets me detect whether the current build is for debug or release? If not, how can I define my own?
As of Xcode 4, the Build, Run, Test, and Analyze actions produce Debug builds by default; the Profile and Archive actions produce Release builds. This is controlled by editing the scheme, selecting the action, then changing the build configuration under the Info tab. To Apple in Xcode 4, the Archive action is the final "build this for release so I can distribute it" action. This is the highest level at which you manage these settings.
At the lower level, your target contains its build settings, which define configurations. By default, there are two configurations: Debug and Release. You can find (and manage) them by selecting the project (the root node) in the Project navigator, then choosing the Info tab. They're found under the Configurations group.
To edit the settings for the various configurations for a given target, choose the target in the Targets list, then choose the Build Settings tab. The grid looks (and sort of is) complicated and you should read the docs for details (esp. the what the different columns represent). To answer your question, each setting can be edited to change the setting for all configurations or expanded with the disclosure triangle so you can specify configuration-dependent settings. For example: under Release configuration, you might want to strip debugging symbols; under Debug, you do not.