Duplicating an Xcode 4 Project - iphone

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!

Related

What is The "App" under "Products" in xcode?

I made a "Truth or Dare" app and now I want to make a sister app of the same look and feel. Instead of starting from scratch and having to do all the cocoa pods stuff, I was hoping to just Copy and Paste my old project folder and edit as needed.
One thing I noticed is that the "app name" under "products" in the left-hand navigation toolbar refers to something I'm unfamiliar with.
Can someone help explain how I would best go about copy and pasting an app to start a new one? What would I need to replace?
Thank you
Don't worry about the ".App" extension file under the "Products" folder. It is recreated every time you run your app.
What you really need is to change:
"Display Name" of your app.
"Bundle Identifier" of your app.
Though creating a target is the best option but you can rename your project and it will rename your target as well.
Click your project in the project navigator and then change the name under Identity and Type in file inspector. You will be asked to confirm rename project content items.

How do I import existing iPhone app without .xcodeproj file into Xcode

I have an existing iPhone app (made on a previous version of XCode by a colleague) that I would like to import into XCode. I have the files FirstViewController.h, .m, and .xib files as well as the ones for the other views that were all renamed. I also have the supporting files, such as the sqlite database that is being used, images, the AppDelegate files, and so on. However, I was given all of these files without the .xcodeproj file. I have been trying to recreate the app given all of these files, but to no luck. Can anyone please give me any hints or direction as to how I should try and recreate this app?
If you absolutely cannot get ahold of the original Xcode project file, I would recommend just going through the standard New Project wizard to create a new project, and then import your existing files into the new project. This would involve, at a minimum:
Launch Xcode (the latest available version)
Create a new project by choosing File menu > New > Project
Choose an iOS application project template which most closely resembles your application
Follow the rest of the wizard steps to create your project
Once you have your new project, import the existing files:
For each type of file, right click in one of the file groups in the Project Navigator in the left-hand sidebar and select 'Add Files to …', then follow the prompts to import your file(s)
Adjust your code to build properly, using Product > Build and Product > Run as needed.
The iOS App Programming Guide can likely answer a lot of general questions about how to lay out your app structure, set up build settings, etc. Code signing and Deployment Target are two important project-specific settings you'll need to configure, which can be done using the project settings editor by selecting the very top row (where it says your project's name) in the Project Navigator. That should hopefully get you started.

groups and files in XCode vs. project folders in Finder

I still can't get the idea that when I create a new Group in XCode, and build the project, and then return back to finder and notice that the group does not exist but any file to be created under this group will appear in the project's directory in finder but that file is alone without being under any group.
(note: I'm not talking about this directory: /Users/username/Library/Application Support/iPhone Simulator/4.3/Applications/uuid/...)
1) can anyone explain why project's directory hierarchy in finder is different from the project's directory hierarchy in XCode ?
2) how can I make the two hierarchies looks like exactly the same between XCode and Finder? so when I create a new Group in future I can see it in finder.
thanks in advance.
Currently you cannot see the group you create in Xcode in finder. Its just a logical entity for you to organise your projects in a better way. Assuming you will be using xcode to make all the changes (including version control) you can use that categorisation and make sense out of it in Xcode.
However you always have the option of creating a folder in finder(your project workspace) and create files and save them in that folder using Xcode. This is particularly helpful for viewing organized code while browsing through the file system. Also you can group files into folders which you can then use across projects.
So basically it boils down to what your use case is. As for me i am happy using xcode. I usually create a directory to hold images and copy directories for libraries into my project folder so that there is clean organisation in the file system too.
Another helpful method is after you create the group in Xcode, but before you put files in it, check the File Inspector pane on the right with the group selected. Make sure Location is set Relative to Group and then click on the folder icon below that. This will bring up a Finder window. Then, make a directory with the same name, and click Choose. Now, anything you put in that group will go in that folder of the same name.
Simple solution is that you make the require folder in Finder, then go to Xcode. In navigator, right click and select "Add files to" option, add the that folder. It will be added to your navigator as well. Now whatever you add to that group, it will be automatically added to your folder in finder as well.

How to rename an iPhone project in Xcode4?

I am developing an iPhone application using XCode4 editor. I have to rename my project. I can't create a new project with new name because I have proceeded too far with my coding and there are too many files in the project.
How can I rename my project in Xcode4? I have searched on net but cant find such options in xcode4 to rename the project.
You can click on project name in xcode and then click again. The field becomes editable. Rename it and it will prompt you to rename the other files and delegate class names.
Its really simple in xcode 4. Renaming files, folders, groups and project names can be done using the above method.
You can set bundle display name in info.plist. it shows your name with icon. and for renaming the folder name simply select the folder and single click on the name then you can change the name.
When you rename your folder name, you can also change your app delegate class name and product name in info where you give provisioning profile for installing on device.

how to copy - paste xcode group copy iPhone?

In iPhone Development, generally we use Xcode.
Now, we manage different groups within our project.
my Question is how do you copy the entire group (with including files in it) and paste within same project or other project?
Right/Ctrl click on the group you want to copy and select "Reveal in Finder." Select the files you want to import into the new project, and then just drag and drop into the new XCode project, being sure to select the "copy these files" check box that pops up. To import into the same project, you'll need to have different file names but you essentially follow the same process.
kmit's answer is correct. Generally you should not make duplicate copies of the same source code files in the same project. If you want to duplicate and change them, sure. But if you want to use the identical files in another target, just add the files to that target (select the group, Get Info, Targets tab, check the other target). You can reuse the same source file for building any number of applications in the same project.