Copy .dylib library from one xcode project to another - xcode

So I have one Xcode project that I downloaded that comes with a ~.dylib file and a folder titled 'include' that comes with all the files for that library.
What I want to do is copy these files into another XCode project.
However I don't know how to get XCode to recognize the ~.dylib file. Right now XCode allows me to create instances of classes defined in this library but whenever I try to call any associated methods it says it can't find those methods and gives an error (presumably because the ~.dylib file is not linked properly.

Try this: Select your project file, choose your target, Build Settings, and search for "Library Search Paths", and add the path to your dylib file to it.

Related

How to Importing files from one project to another

I want to copy some files "Classes" from another project to my current project, but when I run it I get dozen of errors, its seem there are some steps to copying file from one project to another project using Xcode ,
I can make a collection of files "Classes" accessible in my project?
One project is Objective c, the another one seems to be Objective C++
Individual Files
Organize your files
Place the files you will need at a location that is accessible by the Xcode project. Usually, you place these files is a directory below your Xcode project, but that is absolutely not necessary.
Drag & drop
Grab all the files you need and drop them onto your project organizer. You will be prompted with this dialog, to which the settings should look like this (ensure that your target is selected):
Projects
If you want to include a Cocoa Touch Static Library, in the form of an Xcode project, drag & drop will suffice.
No there are not exactly steps we need to follow. Just make sure all dependencies are fulfilled while importing classes from other project. Don't forget to click at checkbox Copy files if needed so that Xcode can make separate copy for your project.
In order to import files in your project click following sequence:
command + option + A
or you can also add files by
Xcode -> File -> Add files to "Project Name"

Changing the name of main folder in Xcode project

This is not the first time I've had trouble with this and I suspect not the last time either. Despite having learned many frameworks inside out I still find the organizational structure of a simple xcode project elusive. I simply wanted to retitle a project from CATouchSynth to ABTouchSynth. A while ago I discovered that if you click on the Project folder in project navigator and than change the name in the Identity and Type section it will rename many of the relevant files and directories to the new name. However, there is one main folder inside the folder on your computer that doesn't change and still has the old name. I could see no way to change this folder name through Xcode and so I renamed it manually from finder. This turned all of my source files and assets red so I manually "relinked" them in xcode and they are now non-red and seemingly linked with the newly named folder. However I am getting several compile-time errors talking about the old folder name but I have no clue what Xcode is referring too. The errors look like this
It seemed as if derived data was an issue so I deleted the derived data folder from Xcode and I still get these errors. Has anyone experienced this before and what can I do to ressurrect my project?
Note: Before doing any changes do backup your project folder. This is seriously recommended.
Follow the steps below to rename the source folder of your project –
Close XCode.
Rename the Source Folder.
Right click the project bundle .xcodeproj file and select “Show Package Contents” from the context menu. Open the .pbxproj file with any text editor (Xcode).
This step should be done with extreme caution. Search and replace any occurrence of the original folder name with the new folder name.
Save and Close the file.
Open XCode project.
The error is happening at build time during the compile phase, so you will have to go into the app target's Compile Sources build phase, remove all those .m files, and add them again.

Managing source files in Xcode

I was moving some files around in an Xcode project and deleted some files in finder (I know). I've broken my project and now I can't figure out how to fix it.
At the moment I'm getting an Undefined symbols for architecture x86_64: error when trying to build. The files however, are actually in the project and physically in the project directory. I added them to compiled sources, but I'm still getting the same error.
I don't understand how Xcode manages the source files and I haven't found any good information on how to troubleshoot these problems. Googling basically tells me to not delete files (too late) and I can't find anything in the Mac Developer documents.
How can I get my source files back in order so I can build this project?
EDIT: I noticed this in compiled sources:
The files that are causing the problems are the ones that don't have "...in Worker" next to them (Worker is the name of the project).
When you try to delete a file, then two options pop up: Remove reference or Move to trash.
If you select Remove reference, then you file is present in the project file directory. You just need to goto finder->your project and add that missing file.
If you select move to trash, then goto Trash, select file, right click and select put back.
If still you are getting error "Undefined symbols for architecture x86_64", then closely observe the error, in the last line of error, some variable name/class name is written there which is missing. Either that variable is declared multiple time or not declared.
I don't understand how Xcode manages the source files
It really doesn't. You add files to the project, and Xcode updates the project file with the fact that those files are in the project and their location on disk. If files go missing from the project (Xcode can't find them because you moved or deleted them), those file names are displayed in red in the project navigator.
So, start by looking for red filenames in the project navigator. Those are files you need to put back. If you're not sure where they were before, or if you want to move them to some other location, you can also just delete them from the project and then add them again.
At the moment I'm getting an Undefined symbols for architecture x86_64: error
That may mean that you've forgotten to add some file or other to a specific target. If you select a source file in the project navigator and look at the file inspector, there's a section called "Target Membership" where you can see which targets the file is part of. If you've just added a file to the project, make sure that the checkboxes next to all the targets that depend on that file are checked.
Go to "Build Phrases -> Copy Bundle Resources" and remove those files which are represented in Red color text.
Also make sure that in your project navigator you should remove those missing files as you deleted them physically from your project directory.
Hope this helps!

Creating Xcode project from command line

My question is how can I create and Xcode project from the command line. By create I don't mean building a project. I mean how can i create a project forlder i.e shift + cmd + N.
Cmake will create Xcode projects along with any other type of build file you could desire. It is heavily customizable and can handle multiple targets, dependencies, linking, and any other property you could image. It has a steep learning curve but is a very very powerful tool. We currently use cmake to genererate both the Xcode and visual studio solution from the same code base.
The simplest example of cmake is $cmake -G "Xcode" ...args... this would create and all all the nessecary files to your project from your args.
Here is the main page: http://www.cmake.org
An Xcode project consists of the source files for the project and and .xcodeproj folder (it looks like a file, but it's actually a bundle, i.e. a folder and files within it treated by Finder as a single object).
If you look inside the .xcodeproj folder (you can do this with the terminal app or you can right-click on the .xcodeproj bundle and select "Show Package Contents") you will see several files. The only file that matter is project.pbxproj. The format of this file is undocumented, but it is a text file and if you take a look at it, the format doesn't seem too complicated.
To generate a project you need to create a folder with an appropriate .xcodeproj folder within it and an appropriate project.pbxproj file inside that folder. If your project needs are simple, you could always start with a canned project.pbxproj file generated by Xcode and stick it in your .xcodeproj folder.

Where does Xcode's open quickly search?

I'm not sure how to get it to index my project files.
Open Quickly should be searching any open projects. There used to be a Preference for paths but I believe it was removed with 3.1?!?
Is it possible that said header file is not on your project's include path? If you added your source folders to your project using the "Create Folder References" option, or if you are using an external build system, then Xcode's indexer will not be aware of that file.
If you had added folders with the "Create Folder References" option, then there would be some folder icons in your project's file list that are yellow instead of the usual blue. If this is the case, you might try removing those folder references and re-adding the folders with the "Recursively create groups" option.
If you are using an external build system (which I suspect is not the case, since this is an iPhone question), then you have to explicitly tell Xcode about your project's include path by setting the HEADER_SEARCH_PATHS option in the Build panel of your project's Info window.
Another possibility is that the file you are trying to Open Quickly might be in a Framework that you have not added to your project. If that is the case, adding the framework will fix it.
Since I installed 10.6, I have been able to use the open quickly dialog to open anything in my user search path.
I am not sure if this is because of Snow Leopard, Xcode 3.2, the re-install, etc…
Check after you upgrade.

Resources