What target is build when I just Build my Xcode project - xcode

If I just build my Xcode 4 project (using the cmd-B) command, which target is built?
I'm having trouble understanding the new scheme setup. When I look at the currently selected scheme, under the "Build" tab, all my different build types are checked (ie: Analyze, Test, Run, Profile, Archive). However, when I build, it seems like only "Run" is built. And for the *.app file that is produced, is this built using the "Build Configuration" set under the "Run" tab?
Thanks!
Sunny

Whichever target that is in selection next to your Run, Stop button in your Xcode.

Related

Xcode 11, where can I manage Build Phase?

I've migrated my app into Xcode 11.
I want to remove legacy resources that copied at Build Phase, but I can't find old Build Phase menu.
Please make sure that you have selected Target instead of Project.
The problem is that you have the project selected (in the "project and targets list", which may be a collapsed pane for your Xcode).
So first, make sure the button to the far left of the "Info" tab shown in your screenshot is toggled on (so you can see your project and targets list).
Then simply select a target. Now you'll see the Build Phases tab. Only the targets of a project have build phases.
Note: If you don't like to keep the targets list shown, you can simply use the popup menu next to the pane's toggle button - which appears when the pane is not shown - to toggle from project to a target.

Running emulator not working (iOS and Phonegap)

I'm trying to run a project on Xcode (4.6.2) with Phonegap (2.7).
I create the project using the create command in the terminal window, and then when I open it in Xcode and click the run button on the top left corner it builds successfully, but does not launch the emulator. Also, when I click the project tab, the "Run" button is not an option.
Any ideas as to why Xcode is not letting me run this project?
Note, I can run other projects in Xcode perfectly, it's just this one I'm having difficulty with.
When you use the create_project script and open the project for the first time in XCode, the CordovaLib sub-project is selected as the Run scheme so it builds CordovaLib OK but there's nothing to run. This has caught me out a few times and left me wondering why my project built but didn't run until I remembered to look at the scheme.
On the main toolbar at the top of Xcode, make sure the Scheme (next to Run and Stop buttons) is set to your project's name (the parent project) and not "CordovaLib" (the child project). The Scheme should read something like "My Project > iPhone" not "CordovaLib > iPhone".

Build Phase Tab Hidden or Missing

I'm probably asking a very elementary Xcode question, but here it goes. My layout has no 'Build Phase' tab. I might have inadvertently changed my layout. A lot of tutorials state that you should go to the Build Phase tab and link to a library. Well, I've Clicked on the Target, and the File under the Target, Searched the Toolbar, searched the project settings, Info. When I right click on the Target File I get a list including "Copy Build Phase" and Add Build Phase, but that's not giving me access to the Build Phase Tab. I've tried 'reset to default or factory layout'.....Build Phase Tab. How can I display the layout with a Build Phase tab in the toolbar, and save it to utilize in my projects? By the way I'm using XCode 3.2 maybe it's a version limitation?
It sounds like those tutorials are for Xcode 4. For your version, if you open the target in the sidebar, there should be some groups. Those are your build phases. Just drag the library into the one that says something like "Link Executable", or click the checkbox to add it to your target and it should go there automatically.

Why doesn't Xcode 4 create any products?

Regardless of build configuration, building my iPad app does not actually output a .app file. It does run in the iPad simulator and on a device, but when I hit build or build and run, the binary appears under Products in red and is not created in the "build" folder as designated in build settings.
Any ideas?
Xcode 4 places its build products and other intermediaries/temporary files/indexes in a derived data directory now instead of a "build" directory that is mixed in with your product files. It does this to deal with the new workspaces and also so that you can have clean builds of different projects in different workspaces without contaminating each other.
If your original template was old, your built product is probably relative to your source directory instead of relative to your built products directory, which is why it's showing up red. By default, your derived data directory will be under ~/Library/Developer/Xcode/DerivedData. To see where your current workspace/project is placing these files, you can File->Workspace Settings... and take a look at the Build Location.
I was having this problem. not only the product .app was red, also simulator wasn't loaded the binary, it was stuck in attaching 'my app'.
i solved it by going to file->project settings. in the tab 'build' changed derived data location to 'project-relative', and in advanced changed build location to 'locations specified by targets'.
with the default options it wasn't possible to run the app, i'm not sure why.
To resolve the issue in XCode 4.x go through following steps :-
Open your project in XCode.
Select .xcodeproj file in XCode project Navigator.
Select the target under the PROJECT Heading. (i.e. the top most target, this target specify your project level build settings)
Now navigate to Build Settings.
Now search for option "Per-Configuration Build Products Path" and update it's value to $(SYMROOT) .

Three20 v1.1 and Xcode 4

Is there an easy way of getting Three20 v1.1 to work under xCode 4?
I followed the steps on http://three20.info/article/2011-03-10-Xcode4-Support but that seems to be for the master. I use v1.1 as I use the TTLauncher.
The project builds fine with a normal build, and runs perfect on an iPhone.
But when I want to create the archive (for the IPA for distribution) then I get 18 errors and 8 warnings.
The first one is:
../scripts/Protect.command: line 23: cd: /Users/XXX/Library/Developer/Xcode/DerivedData/iDoms-cmyivarwxpbvqdfnyclqdrikrtmw/ArchiveIntermediates/iDoms/BuildProductsPath/Release-iphoneos/../three20/Three20UICommon: No such file or directory
Most others are 'no such file or directory' on e.g.:
#import "Three20Core/TTGlobalCoreLocale.h"
or 'undeclared (first use of function)' which comes from the 'no such file or directory issue I presume'.
In my 'Header search paths' I have:
$(BUILT_PRODUCTS_DIR)/../three20
$(BUILT_PRODUCTS_DIR)/../../three20
../../three20/Build/Products/three20
/usr/include/libxml2
Any help would be very appreciated!
Just to add to Colin's answer: you can use Xcode's dependent projects feature to use three20, even though the three20 website says it's not "officially supported":
In your workspace, right-click on the empty space in your project navigator. Select "Add files to "My Workspace", and select the three20 project (three20/src/Three20/Three20.xcodeproj). This is the only project you need to add: it is not necessary to manually add the three20 subprojects.
Select your project in the navigator, go to Build Phases, open "Link binary with libraries", click on the "+" in the bottom left corner, and add the Three20 libraries: libThree20.a, libThree20Core.a, libThree20Network.a, libThree20Style.a, libThree20UI.a, libThree20UICommon.a and libThree20Navigator.a. This will cause Xcode to build Three20 when you build your project.
Add ${BUILD_DIR}/three20 to your include path as per Colin's answer: go to build settings, double click on "Header Search Paths", and add ${BUILD_DIR}/three20 (it will show as build/three20 when you close the dialog).
Add three20/src/Three20.bundle to your resources.
It's probably also a good idea to add the linker flags -ObjC and -all_load if you haven't already done so (same dialog, setting "Other Linker Flags").
The steps above are good enough for compiling the code. To make "Archive" work too, you will need to:
Add $(BUILT_PRODUCTS_DIR)/../three20 and $(BUILT_PRODUCTS_DIR)/../../three20 to the Header Search Paths setting. If you don't you will get compilation errors that the three20 headers cannot be found.
For all Three20 projects (so not just the top-level project), go the Build Settings and set "Skip Install" to YES. If you don't, the project will build, but you will not be able to create an IPA.
Make sure that your product name (select your target, go to Build Settings, then setting "Product Name") does not contain spaces, otherwise archiving will not work.
Finally, if you're getting errors such as ld: library not found for -lThree20 and you are using a custom build configuration (such as AdHoc), make sure to add the same build configuration to each of the Three20 projects too (just duplicate the Release configuration).
You should check out this StackOverflow question.
I've reproduced the accepted answer below:
So it looks like the easiest way
to get old Xcode 3.2 projects to work
with Xcode 4 is to do the following:
Go into Xcode 4's preferences (Cmd+,).
Select the "Locations" tab. Where it
says "Build Locations", select the
drop down and pick "Place build
products in locations specified by
targets" I'll write up a three20.info
article going into more details about
this.
Add these two paths to your header search paths in the build settings for your target:
"$(BUILD_DIR)/three20"
"$(BUILD_DIR)/../three20"
The first entry is needed for regular builds and the second entry is needed for archives.
It's that easy.
Incidentally, to create a file in your home directory with a list of all of Xcode's environment variables for your target's environement, add the following Run script build phase to your target with contents:
ENV > ~/xcode-environment.sh
Note that in this case, if your project is not making it through the compile phase of the build process, and your Run script comes later, the script won't get executed, so put it first.

Resources