Change Version number and build in Xcode 5 - iphone

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.

Related

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.

Where is the "Custom location" in Xcode 4?

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

Duplicating an Xcode 4 Project

Basically I want to make an independent copy of my Xcode project and all of my files. How can I do this? I'm researching graphing frameworks and I want to use the same UI for each.
Seconding #zoul's comment, this can be accomplished in Xcode 4.5 with four steps.
In Finder, duplicate the project folder. Do not update the .xcodeproj file name.
In Xcode, rename the project. Accept the proposed changes.
Still in Xcode, rename the scheme in "Manage Schemes".
In Info.plist, rename your Bundle identifier.
Few months ago, I had the need to create a different applications with the same source code.
I didn't wanted to copy the full directory, so I came up with a procedure that allowed me to mantain the source code in one place and create many different apps based on the same source code.
My procedure is the following:
duplicate the target to make a new target and change the name to the new name
change the name of the product and info.plist in the build options (select the new target and click info button), make sure this is for All Configurations
rename the info.plist file created at the duplication to "newnameInfo".plist (click on the file and then info button and pick the target)
add icon.png to the resources for the specific target.
change the name of the icon
in the NewnameInfo.plist change the icon name to icon_xxx and the bundle identifier com.yourdomain.newname
in language/other flags you can have a flag to check at the code.
create a new APP_ID in the iOS Provisional Portal
if APN is used, configure the APN BEFORE creating the development profile
create a new development & distribution (ad-hoc or appstore)
in Target (info) choose the right profile for the code sign
I hope this helps.
--nnahum
Go to your project folder. Right click on it. Select "duplicate".
Is there something you want to achieve that this doesn't accomplish?
Copy and paste your project folder. Open the new folder and open the Xcode project file. Select the project name in the "Project Navigator" on the left side and then in "File Inspector" on the right hand side, change the name of the project under Identity and Type.
That way you will have a duplicate project with two different names.
Hope this helps!

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)?

Restore Project Settings in XCode

How can I restore Xcode project settings? I can't see few settings (like Targeted Device Family, iPhone OS Deployment Target, etc.) after I gave my Macbook to my friend. :(
I also saw that the info.plist file was not in the project, I recovered it via TimeMachine though, the Base SDK is also missing. :( She messed all things up, I don't know why she went in there. Anyways, is there any way to restore the settings?
Unfortunately, the snapshot that I have is also very old. :(
No way to restore them. You can set the base sdk on the project info screen.
Project > Edit Project Settings > Base SDK, Check the same for your Target.
Is this issue occurring for a specific project, or all projects? If you create a new project, what happens?
I forget the exact syntax, but different versions of XCode handle project files slightly differently. A new SDK (and version of XCode) couldn't read my project file right (same symptoms you explain).
In my case, there were 2 different SDK settings in the project file due to 2 separate versions of XCode editing the file (this could be very likely if you restored from backup and had upgraded SDKs in the interim).
Look for something like:
SDKROOT = iphoneos4.2;
Or really, just look around the text that contains the build settings (all of your build settings are stored in the file in flat text) -- you may see something related to SDKs where there are 2 lines very similar right next to each other. That'd probably be your problem. If you don't know which to delete, try both and then re-set the setting using the interface.
Of course in any case, you should back up your project file (project.pbxproj) before trying any of this.