I am considering using CocoaPods on an existing iOS project.
However I got confused when I read the installation instructions, which say:
Make sure to always open the Xcode workspace instead of the project
file when building your project:
$ open App.xcworkspace
I have no idea what they want to tell me with that. I know there is a .xworkspace file within the .xcodeproj bundle.
But does that mean I can never again simple double click on my .xcodeproj file? Can I no longer open the project from the XCode recent items menu? And do I always need to open it from Terminal?
The concept of CocoaPods sounds interesting, but I don't want to mess with XCodes internal project structure...
A workspace is like a step up from a project. It can contain several projects. When you install Cocoapods on your project, it creates a workspace which contains your original project and a new Pods project which contains the code from the pods you are using.
It also creates dependencies between your project and the pods project (since your project needs the pods project to be built before you can build your own, it has to look for the headers, etc.). Because of this, if you subsequently open the project file instead of the workspace file, it will fail to build because it doesn't have the right information about the Pods.
The change doesn't really affect anything about the way you work - just double-click the workspace file instead of the project file, and the workspace will subsequently show up in your recent items list.
You don't need to open it from the terminal, that guide is just there because you would have installed the pods from the command line, so it is a convenience to then open the workspace file immediately from there.
Related
I am working with an existing GitHub repository and I want to create a new Xcode project from it. How can this be done?
I have previously used Xcode just as a python script editor and never created a project, but I would like to do so in this case so that I can have a special indentation style just for the files in this project (this is Python, so no interest in build targets etc, just want to edit and use git).
I am using Xcode 6.0.1 on Mavericks.
IanAuld's answer sent me in the right direction and I figured out what I was doing wrong. I had been assuming that the Xcode project should be inside the directory with the git project, but that was causing problems because then git tries to track the Xcode project.
Here's what I am now doing, which seems to work:
Create a new Xcode project somewhere that is not managed by git. Make sure that "Create Git repository on ..." is not checked.
Clone the github project to a directory that does not include the Xcode project.
In Xcode, File | Add Files to "ProjectName"..., and select the folder with the git project.
Now, if I edit any of those files in the context of the project, it uses the indentation style I set for the project (though if I edit the file on its own it uses my global indentation style), and I can control git through the Source Control menu.
Problem solved.
Currently I am working on a team project with Xcode that is stored in Foo.xcodeproj. We all work on our own branches and do git pull requests for merging into the common dev branch. I am at a point where I want to use CocoaPods and once I do a pod install then the workspace Foo.xcworkspace will be created. The CocoaPod docs say:
Make sure to always open the Xcode workspace instead of
the project file when building your project
On my branch I will have a workspace file whereas everyone else will be still working directly with the project file. I am trying to be preemptive and avoid difficult git merge conflicts. Will it matter if my teammates are still opening the project file or are we going to have merge conflict hell?
Being a one team you all should work in one either in Project or Workspace, are you the only one using cocoapods no one else in Team wants to get the functionalities available through Pods.
If you are the only one continuing with PODS be careful while committing the project file in git.
Answer to your question, just commit your Podfile, podfile.lock and .xcworkspace file in git and whenever the other teammate is getting the pull ask him to do a pod install and then open the .xcworkspace file to work as you did initially.
It's clear how to add an existing project to GitHub outside of Xcode, there are a number of tutorial: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
There are also a number of tutorial of how to create a new project in Xcode under version control.
However, there are no tutorial on how to do both: add an existing project with the controls within Xcode. Is this even possible? Or since I already started the project, I'll have to do it all via command line?
Since you didn't ask Xcode for a local git repository inside this project folder when you created the project, you will have to create one via the command line.
After that, you can use Xcode's internal GUI to give git commands in your project - if that's the kind of thing you really want to do (personally I abhor Xcode's git interface).
How do I add Source Control to an existing project?
On some of my projects (originally created in Xcode3) I added Source control in Xcode4. I recollect there was an option to do this.
I now want to do similar for some old projects, but can find no way to do so.
I have searched and the only "solutions" I can find is to create a new project, and copy the original source files.
Unfortunately the way Xcode5 structures a new project is quite different, so this is not straightforward.
Is there a way to do this in Xcode5? I could probably do this in git, or even go back to Lion, but I am sure I am not the only person who wants to resurrect an old project.
Xcode doesn't have an option to create repositories for existing projects. You'll have to create a git repository from the command line. Launch the Terminal application, navigate to your project's directory, and run the git init command to create a git repository for your project.
If Xcode doesn't automatically recognize the repository you just created, open Xcode's Accounts preferences and add your repository from there.
I've got a workspace containing an iOS app project, which is dependent on another framework project, also in the workspace. I ran into issues with Archive while building for distribution, where the resulting output was unusable for creating an .ipa. Googling turned up this solution, where you delete the Copy Headers phase from the framework project, and which worked for getting the Archive exported and submitted, but now when I go back to running the app project in debug, I'm failing builds due to missing header files from the framework project again. So, what is the proper way to configure everything so I can both archive and run in debug without having to go through all this nonsense? I mean really, I'd think this would be pretty typical.
I ended up replacing the previously deleted Copy Headers phase within the framework project, with a Copy Files phase, and that did the trick.