This is possibly an extension of
How can I add an existing project as a working copy in XCode 4?
I have an existing iOS XCode project 'Project A' with one target, which is the app it builds.
Now I have another project 'Project B' I am currently working on and would like to add the 1st project as is to this one as and include it as a feature.
When I drag the .xcodeproj file of A, I can see the project come in, however, it brings in the target as well. When I look at the 'Target Membership' of any file in A, it has A's target and I don't see B's target.
What I would like to do is only have B's target and link all files in A to B.
I tried creating a lib out of A but that process is far more tedious. I would really like to proceed down the copy+link path. Can someone suggest what can be done?
Sounds like you might be more interested in an Xcode Workspace, unless you are truly interested in merging these two projects for good.
If you want to bring in all of the source files of the other project, you can right click the project in Xcode and choose "Add files to 'MyProject' ..." and in the interface that is presented you can choose target membership. I would go this route to "merge" the projects together rather than dragging in the full Xcode project.
There very well may be a way to do it how you are hoping, but this is the route I know and would take.
Related
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.
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.
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!
I'm new to iPhone development and I'm still getting familiar with the Mac dev environment, including Xcode. I want to add some 3rd party code to my iPhone project, but when I add the "existing files" to my Xcode project, I'm presented with a dialog box that has far too many options that I don't understand and, as such, my project isn't working. When I #import headerfilename.h, I get a build error that reads headerfilename.h: No such file or directory.
alt text http://joecrotchett.com/images/misc/fileadd.jpg
Can anyone explain to me what all these options mean or give me a link to some documentation that can? I'm having a hard time finding anything in Apple's docs.
Which options do I want to choose to add existing source code files to my Xcode project? I should note that the source code files that I'm trying to add are located in my project/Classes/frameworkname/ directory.
After they're added, do I need to reference this new code directory in my project settings anywhere (i.e. some kind of header file directory variable)?
Thanks so much!
Update: I found the following answers/responses on the apple dev forums that were very useful and helped me fix my issue...
To make it simple :
- if you do not check the copy option, the file stay where it is.
- if you check it, it is copied in your project folders In the first case
(what it seems you are doing) you need
to tell the compiler that the header
files are in another directory :
- project info -> build -> search paths -> User Header Search Path : add
the directory from where you took the
header file Hope this will help
You have discovered the most confusing
dialog box that ever came out of
Cupertino. Six years of Xcode, and
this thing still is partly a mystery
to me. To even get that far, I had to
make many test projects to try and
reverse-engineer what this thing does.
The "Copy" box means that it will copy
the files as they are right now, into
the project. If this box is not
checked, then it just references those
files during a build and copies them
as they are at THAT time. For source
code, you want the Copy box checked.
The "relative to" is a total mystery
to me and I can't help you with that.
I usually leave it however it is
already set. Does it mean relative to
where they are on disk, or the
arrangement in Xcode, or in the
bundle? Who knows. The last 2 radio
buttons SEEM to mean that it will
either re-create the folder structure
of the folder you are adding, or just
put "fake" folders in Xcode that point
to the real folders. This is probably
your problem - you are adding source
code that is not all at the top level,
and when it goes to find it, it does
not re-create the hierarchy. Others
can supply a better way, hopefully,
but what I would do is put all of the
source in one folder and add that,
using the Copy box. Then in Xcode you
can make whatever bogus folders you
want and put the source file names in
those fake folders.
This is from the Xcode user guide:
"The project navigator shows projects, groups, folders, and files:
The project or projects in your workspace window are the highest level
of the hierarchy in the project navigator. Open the project’s
disclosure triangle to see the groups, folders, and files in the
project. Select the project to display the project editor, where you
can view and edit project and target settings.
A group appears in the project navigator as a yellow folder icon. The
group does not represent a folder on disk. Although you can organize
your project in Xcode to reflect the organization of files on disk,
moving files into and out of groups does not affect the content of the
folders on disk, and moving files on disk into and out of folders does
not affect the content of the groups in the project navigator.
A folder is a reference to a folder on disk and appears in the project
navigator as a blue folder icon. The contents of the folder in the
project navigator reflect the contents of the folder on disk. It’s
important to note, however, that the files that appear in a folder
icon in the project navigator are not part of your project unless you
have added them to the project explicitly (in which case they appear
directly under the project or in a group, as well as in the folder).
You can view and edit the files in a folder, but to move files in and
out of the folder you must use the Finder.
A file in the project navigator is a reference to a file on disk."
I think usually the default option is the best one. If you want to add into some group, you can tick on the "Copy Item to Destination group"
You don't have to change any project settings after adding
And if you want to add the whole framework code, please choose add existing framework
Copy items into destination group's
folder (if needed)
Well, only if you want it to copy the files. If you are happy with their existing location and don't want it to copy them, don't select it (that's what I do).
Reference Type:
A total mystery to me
Text Encoding
Self explanatory
Recursively create groups for any
added folders Create Folder References
for any added folders
Leave this as the default and then organize the folders in your Xcode project any way you want.
Add to targets
If you add an additional target to your project, e.g. for iPhone vs. iPad versions, then not noticing that it has by default added the files to just one of them (at random?) can cause headaches.
Also, make sure you add the new header directory to your search paths in Project Settings > Build > Search paths. I think that's what's causing your problem.
Hope this helps, I remember how confusing this was to me at first.
If you want to add an Framwork Bundle, just add is as one. Add -> Existing Frameworks
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.