XCode SubProject configuration - xcode

due to working needs, I need to integrate an xcodeproj into my existing project as subproject.
The structure of my two projects is the following
Structure of the two projects
What is the best practice to integrate (no cocoapods) the subProject into my main project?
I have done the following steps as you can see from the picture below:
Integration Steps
I have copied the folder and all the files to my MainProject
folder.
In XCode I have added files to MainProject and then I have choose
the "SubProject.xcodeproj" and I can see the structure in the
project navigator.
I have added into the "Search Header Path" the following sentence:
"${SRCROOT}/../SubProject" with recursive search.
I am not be able to import into my main project the header of the sub project. How can I solve my situation? What I am missing?

Is not clear what you mean with "Integrate a sub project". What to you want achieve? A single target or every project should build a different binary?
First of all I would suggest you to put both project in the same folder, in your example they are both inside the Desktop folder so this is ok.
As second step you should create a workspace, and add both project to this workspace. There is no need of moving folders around, just drag the project icon inside xCode, just below the workspace icon.

Related

Add dependence project to XCode

I deleted a building dependency by accident, and want to add it back like this:
and I have already checkout it from another git branch as a subfolder of the main project folder, in the subfolder, there is a .xcodeproj there
I google around and some one says that I should drag/drop the .xcodeproj or the entire subfolder to the project explorer, but either works
Here is the subfolder in the main project folder
So how to do that?
Finally, I figured this out:
This thing is called workplace designed to manage multi-project in one Xcode instance
To add a project to the workplace, you should
Open the projectName.workplace instead of projectName.xcodeproj
File -> add Files to "youWorkPlaceName" -> select the projectToadd.xcodeproj and choose what the sh*t options Xcodes give's (if you can understand, this tutorial video will help) and Click add
Then you are ok.

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.

Xcode how to add an external project

I need to add an external project to my Xcode project, the reason for this is I need to add a Target Dependency on that external projects static library.
I can't seem to add it in the way I need, I would like it like this:
However, when I add another project to my actual Xcode project I get the following which doesn't let me explore that project from my one and so I can't add the dependency I need.
Note that these screenshots are from two different projects, and in the one which is showing me what I want to reproduce in my own project, dragging in multiple projects works as expected.
Maybe I have some settings set up wrong in my project ? All I've done is take a template detail-master application from Xcode.
You did it right. The problem is that Xcode cannot have the same project opened twice.
Close Serenity.xcodeproj before reopening your parent project.
Yes, this is possible, it's called a workspace.
In your example:
Open both of your projects
Drag the Serenity project into the Dependant project
I think what you are doing wrong is dragging the Xcodeproj, try opening that project and dragging the project block instead (see pic)

Xcode : Adding a project as a build dependency

Im playing around with the soundcloud api, in its instructions it says to
drag SoundCloudAPI.xcodeproj into your project
add it as a build dependency
I can drag the project in pretty easily, but how does one accomplish the next step?
To add it as a dependency do the following:
Highlight the added project in your file explorer within xcode. In the directory browser window to the right it should show a file with a .a extension. There is a checkbox under the target column (target icon), check it.
Right-Click on your Target (under the targets item in the file explorer) and choose Get Info
On the general tab is a Direct Dependencies section. Hit the plus button
Choose the project and click Add Target
Select your project in the navigator on left.
Open up the drawer in the middle pane and select your target.
Select Build Phases
Target Dependencies is an option at that point.
Tough one for a newbie like me - here is a screenshot that describes it.
Xcode 10.2.1
Under TARGETS in your project, right-click on your project target (should be the same name as your project) and choose GET INFO, then on GENERAL tab you will see DIRECT DEPENDENCIES, simply click the [+] and select SoundCloudAPI.
Just close the Project you want to add , then drag and drop the file .
Xcode add a project as a dependency
Xcode 10
drag-n-drop a project into another project - is called cross-project references[About]
add the added project as a build dependency - is called Explicit dependency[About]
//Xcode 10
Build Phases -> Target Dependencies -> + Add items
//Xcode 11
Build Phases -> Dependencies -> + Add items
In Choose items to add: dialog you will see only targets from your project and the sub-project
Today I faced with the same problem.
As the result of the first run I got next error:
Lexical or Preprocessor Issue: 'SDKProjectName*/*SDKProjectName.h'
file not found.
But before running, I, obviously, added my SDK into the demo project, just drag&drop .xcodeproj file into my test project's source tree. After that, I moved into Build Phases tab in setting of the main xcodeproj file (of the demo) and added my SDK as target dependency and embed framework into corresponding tabs.
But at the result, I got an error above!
So, the problem was into empty line on the Header Search Paths option. I just wrote "../**" as value for this key and project compiled successfully. So, after that, you can add #include <SDKName/SDKName.h> into any project, which includes this SDK.
ps. My test app was created into root SDK folder.

Resources