Where is the "Custom location" in Xcode 4? - iphone

As we know, in xcode 3, there is a "custom location" in project info. Where is it in Xcode 4? I found many "Path" can be set in xcode4's Build Settings, such as "Intermediate Build Files Paths", "Build Product Path", etc. Which one should be set or should all of them be set?
Thanks!

This setting is not necessary to set in xcode 4 as it sets the location automatically.
From this forum thread:
You no longer need to do this in Xcode 4; it automatically segregates
build products from each workspace in
~/Library/Developer/Xcode/DerivedData. Instead, you need to make a
workspace with the appropriate projects as members (along with your
other app/framework targets).
If you look at one of the iOS sample apps, you should be
able to just open it and build (since those already have project
references for the frameworks and Xcode 4 follows the sample).
Check out this doc for specific project/workspace build settings:
http://developer.apple.com/library/mac/ipad/#documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html

Related

Remove static library based on certain preprocessor macro

I have one functionality and it is depending on one static library. Actually, Apple is not allowing this static library because of few reasons. So, for now we have decided to add one Preprocessor macro and based on that functionality should be switch on/off.
I have switched my code to behave based on that Preprocessor macro. But I didn't find any to link or unlink the library based on preprocessor macro. I can not allow to link the library all times, as I have already told apple is not allowing it.
One solution that I already know : I can create the multiple target. But problem is that my app has already lots of targets. So, again to manage this I have to create one more target for each target those are already created.
Any help will be appreciated.
Edit:
I have created configuration like Francesco suggested. But One quick question I have let's say If I will remove the path of library from "Library Search Path" then that library will not be linked to app? Because that library is still in target of App.
Instead of targets you can create multiple configurations. And you can change the linker flags there.
I did this think for Sparkle framework (which is not allowed on App Store)
EDIT:
To create/manage the configurations click on the project in the sidebar. Then in the main window select again the project, not the targets, and select the "Info" tab.
Together with Deployment Target selection and Languages you will find a Configuration section.
You can add or remove configurations from there.
Then to launch it you have to go to Product -> Scheme -> Edit Scheme -> Build Configurations.
You can duplicate an existing scheme and choose the correct configuration from there.
You can remove the static library from the list of linked items by setting a (somewhat undocumented) Xcode build setting:
EXCLUDED_SOURCE_FILE_NAMES = libUnwanted.a
You can do this in an .xcconfig file or in the normal target build settings UI (by adding a custom build setting). If you for example set this in the "Release" configuration Xcode will include the library in the "Debug" build but omit if for the release build.
EXCLUDED_SOURCE_FILE_NAMES works with all kinds of files that can be added to a target: source files, resources, libraries, ...
Here's how to do this step by step:
Open the target build settings by clicking on the blue project icon in the Project Navigator and select the Build Settings tab.
Click the plus icon to add a "User-Defined Setting"
Name the setting "EXCLUDED_SOURCE_FILE_NAMES"
Expand the Configurations for the setting and set the "Release" value to the name of your unwanted library.
Credit of this answer goes to Nikolai Ruhe & Francesco
I have combined the answer of both and I got the solution.
Here are the steps that I followed.
Created new configuration. ( To know how to create configuration see
the answer of Francesco)
Added flag EXCLUDED_SOURCE_FILE_NAMES in user-defined setting of Build settings. (For steps see the answer of Nikolai Ruhe). And in this flag I have added the name of my static library under the my custom configuration.
Here is a good tutorial that will definitely help you : Remove tesflight from Distriubtion

Change Version number and build in Xcode 5

I have upgraded my Xcode to Xcode 5. From where can I change the version and build number which are now not visible in Target Summary?
Select your project on the left. Then under target, select the target.
Note it's in the General tab.
In the screenshot you posted your target is a library, which do not have the build/version number.
Select your target and then go to the General tab.
Then Identity you can change the Version ad the build
Or open the Info tab and then Custom iOS Target Properties, here your can change the build and version number.
In left pane select project name - > select target -> General choose version and Build.
make sure target is selected , if project setting is selected you won't able to see desired options
Go to your target, there you can modify them:
in General: under Identity: under your Bundel identifier: version and build
in Info: under Custom iOS Target Properties: Bundel version
You might want to check out a new tool I've been developing called Xcodebump. It can handle updating both CFBundleShortVersionString and CFBundleVersion. As a final step it will also checkin to git and tag the commit to match up with those CFBundle values.
The Xcodebump project is located here:
https://github.com/markeissler/Xcodebump
I developed Xcodebump because agvtool has become a bit crusty and this topic comes up on Stackoverflow quite often.

xCode 4.3.2 - Understanding Add to Target

I have an app which contains an SQLite database. I have just upgraded to Lion and xCode 4.3.2 and when I now drag and drop a new version of the database in xCode I get a box which asks if I want to "add the file to targets".
The box is not ticked by default. Is this correct or should I be adding an SQLite database to targets (and what does this mean) ?
Thanks !
A target specifies a product to build and contains the instructions for building the product from a set of files in a project or workspace - (Apple's Documentation)
Since you project may contain more than one targets (products) what XCode asks you basically is whether you want to include this asset in the target (so to have access to it).
Of course you should add the SQLite file to the target for which you want to use it. It means that you want to attach the file to specified target, In case of many targets you might want to add particular file to specific target.

Strange behavior of Xcode Build Products Path under Build Locations

I've been looking for an answer but I couldn't find so I'm posting the question here.
Every Project I created under Xcode4 gets the exactly the same "Build Products Path" under the project or target settings - Build Locations
I wonder if this is because I did something back in Xcode 3 and somehow permanently set the value ?
I have uninstall completely and re-install from scratch and still the same thing.
I just created 3 brand new ios projects (windows based) under the xcode4 and those all have the exactly same value for Build Products Path... in my case, it's always pointing to
/Users/RebeccaKennedy/Documents/Projects/iPhone/tmp
every time! every project... this is getting really annoying...
Close all your projects in Xcode, but leave Xcode open
Open up ~/Library/Preferences/com.apple.dt.Xcode.plist
Find the key: IDEApplicationwideBuildSettings
Delete the two items in that key
Save, restart Xcode
be careful w/ step two. the .dt. is for Xcode 4. without the dt is for Xcode 3.
This is almost certainly the result of Xcode migrating old preferences to 4 from 3.
You haven't said what you've tried...but check this setting in Xcode Preferences.
I assume you've check these two locations (search for tmp)?

When compiling for multiple targets in XCode, how do i ensure that certain files will not be included one target

I searched for a long time on stackoverflow using every keyword I could think of to solve this. I am programming for iphone and I have a lite and paid version of my app. I followed the instructions here Creating Lite Versions of iPhone Games / Apps for duplicating the target. This works and now I am working on slimming down the lite version.
Main problem? Images. The lite version needs to have several hundred less images than the paid version. So, I made 2 groups in XCode. One "Folder Group" in Xcode - named "FreeImages" and another "ProImages". I want all FreeImages only to be included in the lite app and all FreeImages and ProImages to be in the paid app. I do not care that XCode considers these Groups to be Virtual Folders. I reversed the instructions to a point and have an environment flag (-D) set in XCode "PLUS_VERSION" I want XCode to basically do the following:
If (PLUS_VERSION)
{
copy contents of FreeImages *and* ProImages where normally they go
}
else
{
copy contents of FreeImages where they normally go.
}
Anyone know where to start to tell XCode to conditionally copy contents of groups into the target?
For each resource (or folder of resources) you want to direct to a specific target, you can click on the resource and inspect it (either via right-clicking and selecting Get Info or by clicking on the Inspect toolbar option). Within that info dialog will be a tab called Targets, where you can check the targets you want the resource (or even source code file) to be incorporated into, and uncheck the ones you don't.
Alternatively, I believe you can navigate to the target itself in Xcode, click on the triangle next to its name to expand the list of build phases, expand the Copy Bundle Resources build phase, and manually delete from the list there any resources you don't wish to have copied over into that target.