How to enable Source Control in existing iOS project? - ios

As in the topic - i have a project that doesn't have Source Control enabled, so how (and if) can i enable it now? I use Snapshots but the project became a big one, and now i need some more "pro" tools. I'm still rather an xcode beginner, so please explain it like i was a cow.

First off you'll have to install the command line tools for github. You can do so from this link http://mac.github.com/, then either during setup it will ask you to install command line tools, or if it doesn't, you can do it from the preferences menu. Once this is completed, you will be able to follow the instructions on this website to convert your project: conversion tutorial. After all that is done, this website explains everything you could possibly want to know about Source Control and all you can do with it.
EDIT
If you do not want to install github for the command line tools, you can install Homebrew, which is a package manager (macs equivalent to apt-get), then run brew install git for the latest version of git.

After doing a git init,go you the projects tab in the Organizer (top right corner in xcode) There remove the reference to your project and restart xcode to update the changes. Removing the project from Organizer will not delete any files, it will only clear the caches.

I am not sure how to do this from within XCode, but if you are on OSX you can easily initialize git from the command line (within Terminal). From the base directory of the project invoke git init.
Once the project is associated with a git repository, XCode should recognize that and you will see the project listed among the repositories in XCode's Organizer (available from the Window -> Organizer menu)
To upload the project into github, look at the directions here: https://help.github.com/articles/create-a-repo

Related

Why is xCode asking for Android Studio Gradle files?

I had to delete Android Studio off my MacBook Air to free up space for an xCode update. Now xCode is complaining its missing Android Studio files that have nothing to do with it but are somehow titled
file:///Users/administrator/Documents/Retrographic/Sprocket/Android/Gradle%20Binaries/gradle-2.2.1/lib/plugins/xbean-reflect-3.4.jar: warning: Missing file: /Users/administrator/Documents/Retrographic/Sprocket/Android/Gradle Binaries/gradle-2.2.1/lib/plugins/xbean-reflect-3.4.jar is missing from working copy
What the heck is this and how do I fix it? I tried re-downloading the branch in SourceTree and pointing xCode at it but its still having the same problem. Do I need to just nuke and re-install xCode?
:(
This seems very unusual...
My best guess would be to go through your various build settings in your project targets and ensure that this file isn't listed under anything for linking, building, etc.
If it is, delete it, provided you don't need it for your XCode project.
This error occurs as that file was under your version control system such as git and now it is removed. xcode checks the status of git and complains if a file was removed. You can go to your version control system and commit this change so that xcode doesn't complain. If you are using git, you can do the following:
git status
--> This should tell the file was removed
git commit ...
Some possible solutions.
Solution 1
Open your xcodeproj/project.pbxproj in a text editor
Search for "xbean".
Remove that line.
Solution 2
If you are using an xcworkspace, there may be some other project that is including that file. In that case, I'd do that for all project files. If that is infeasible, do a grep grep -r xbean . and then edit the named files. This command will recursively search for all files mentioning this particular file.
I'm not sure why is this happening, but i think there might be some file references in your project which are no more existing.
You can try this:
Search and delete missing files.

Xcode 7 not working properly with source control

I just updated to Xcode 7, all system is updated, including command line tool, repaired disk permissions. And I still have several issues with that Xcode.
I am using GIT, but when I launch my project Xcode is ALWAYS asking me to upgrade to Subversion 1.7 even when I click on "Don't warn me again for this workspace" he does not remember.
When I quit and relaunch Xcode do not use my credential for GIT when I push he ALL the time ask me to type them.
When I go to preferences it builds up a stack of ghost buggy accounts...
And when I go to github, I realised that Xcode do not send my user.email when committing and pushing as I got a default email of ganzolo#noreply.github.com.
It's really annoying and buggy, does anybody have a clue?
I've removed SVN but still when I am doing a regular commit from command line (Git uses my user.email), when I am doing from Xcode he send like anonymous, really annoying.
You must have a subversion repo in your source tree, possibly in a 3rd-party library, that you are unaware of.
Go to Terminal and do this to upgrade it:
$ cd /path/to/sourcetree
$ find . -name .svn
If you get a hit then:
$ svn upgrade path/of/svnrepo
Better still dump the .svn directory and use git all the way through, if this 3rd-party library is also part of your permanent source tree.
Thanks to this post I found a solution :
https://stackoverflow.com/a/32546171/706189
It appears that Xcode have a bug and do not read global user.name and user.email. Therefor you need to set it locally in your root folder project.

Version control in iOS for an update

I recently released an app to the app store, and it works pretty well, but there were a few errors that I need to fix in an update. Namely, sometimes the score doesn't save correctly, and users cannot listen to their own music in the app. I never used version/source control when building the project, and I never used github.
So, I'm wondering if I should save a copy of the current version before updating it, or if the archive (created when I submitted the project to iTunes connect) is a suitable copy of the project (or is the archive in binary?)?
If the archive does not work as a copy of the code I can revert to (because it is in binary), are there any recommendations on how to save this working version of the app? Also, should I change the plist version before making edits?
Thanks. If this question is unclear just comment and I will try to explain better.
The best answer is simple: use a dedicated software version control system.
Use Git.
Git documentation and getting started help.
It's very easy to get started, even if you already have a ton of code.
$ cd ~/path/to/project
$ git init
$ git add -A
$ git commit -m "This is the version that is currently on the store"
Done.
Alternatives:
Create a copy of your Xcode project folder.
An Xcode archive is not good enough because you may need to revert back your code.

Xcode bot: cloning multiple repositories before build

I have three repositories for my current project. They contain some shareable core functionality and individualized components:
MainApp.git
Components.git
Controls.git
The xcworkspace lies in MainApp.git and links to its own xcodeproj file as well as the other xcodeprojs in the two other repositories.
When creating a bot in Xcode server, there's only the option to select one repository for cloning. This lets the build fail eventually, since it cannot find any resources needed from the Components.git and Controls.git.
How can I achieve a working build with my workspace configuration?
You could:
1) Add all the code to the main repo (I highly advise against it)
2) Use a dependency manager such as Cocoapods, where you would have to create podspecs for your dependencies. If they are open-source great they are probably already in GitHub in Specs. Integration between Xcode bots and Cocoapods is kind of broken right now. You could have a pre-build script running the command:
pod install
Amongst other things. See here
3) Use git submodules. They can give you some headaches but they usually do the job when it comes to managing enterprise dependencies. Once again, unfortunately, they are completely broken in Xcode bots:
Xcode bots with git submodules
Problems with Xcode Bots
The list is large, a mere search on twitter for problems related with git/cocoapods and Xcode bots will show you how frustrating it can be.
My personal opinion, if it is a small project and you want to see what Apple's been up to, Xcode bots are great, also the built-in integration inside the IDE is amazing and something to look for in the upcoming iterations.
However, if the project is complex, with some dependencies, maybe UI Automation, integration with Testflight/HockeyApp, etc, I would go with either Jenkins or Travis CI.
Stick with something that has a great community, years of development, plugins..
I was looking for this answer myself, but was not satisfied with the suggestions.
Turns out, it is possible to do everything inside Xcode with just a little helping from the Terminal.
I detailed it here: http://swiftrien.blogspot.com/2016/04/xcode-server-and-multiple-repositories.html
But will summarise here.
1) Create a workspace directory. None of the projects to-be in the workspace should be in this directory (or any of its subdirectories).
2) Using Xcode, create the workspace. You can add the projects now.
3) Exit Xcode.
4) In Terminal go to the workspace directory and do "$ git init"
5) Add a ".gitignore" file with ".DS_Store" and "xcuserdata".
6) Add the files with "$ git add ."
7) Commit the files with '$ git commit -m "Initial commit"'
8) Exit Terminal, start Xcode and open the workspace
9) Use the "Source Control" menu to verify that you now have a git repo for the workspace.
10) Use the "Source Control" menu to add a remote repo on the server.
11) For all projects, use the "Source Control -> Configure ..." menu to tell Xcode that that repo is necessary to include in the checkout.
You will need to create new bots or upgrade the old ones.
Good luck.

-bash: git: command not found in Xcode 4 in lion osx

Through Xcode 4.3 ->file -> source control -> repositories -> clone repository, I've cloned a repository from codesion.com. but when I go a git init or git add, the error -bash: git: command not found shows up. Now, Xcode 4.3 comes with the git installed, so what should I do to get this working?
Any help on this would be great.
Thanks in advance.
There is another option if you're not experienced with UNIX or you just don't want to mess with the system variables from the terminal. I had the same problem, and after some reading on SO and apple developer pages I've decided to install the Command Line Tools for Xcode. That solved the problem.
As the Xcode IDE from some 4.x version is an .app package and everything is stored inside that package, they have added the possibility to separately install the command line tools so that you have the command line tools inside the usr/bin/ path.
You can install the command line tools (as well as some other tools and documentation) from the Downloads tab of the Preferences window in Xcode (I have version 4.3), or from the apple developer website.
It's a path issue. See this question for the answer:
How to move GCC in osx from xcode to /usr/bin
(P.S. The question is different, but the answer the same.)

Resources