Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it safe to ignore /xcuserdata/ with Git if using Launch Arguments?

I have an argument being passed on launch: -D DEBUG which allows me to use the following in my release app:

#ifndef DEBUG
    /* Some code I only want to be run when using the release app */
#endif

When I run git status, it shows me that the file changed when adding -D DEBUG is MyExampleProject.xcodeproj/xcuserdata/myusername.xcuserdatad/xcschemes/MyExampleProject.xcscheme

Which should be excluded using the commonly used Xcode .gitignore file. Is there any other way to include this argument that complies with .gitignore and doesn't rely on my user accounts xcuserdata?

like image 617
squarefrog Avatar asked Dec 19 '12 12:12

squarefrog


People also ask

Should you commit Xcuserdata?

Generally the xcuserdata is safe to ignore for individual projects. Each user gets their own file that saves userstate, folders opened, last file opened, that sort of stuff. It does contain your schemes. If it is the first time opening and the file doesn't exist, Xcode will create it for you.


2 Answers

Generally the xcuserdata is safe to ignore for individual projects. Each user gets their own file that saves userstate, folders opened, last file opened, that sort of stuff. It does contain your schemes. If it is the first time opening and the file doesn't exist, Xcode will create it for you.

However... we have run into this issue at the office when you have a continuous build server, like Hudson or Jenkins, that copies the source from Git or SVN without ever opening it and tries to build it. If you ignore this file, there will be no schemes to build against or it will force someone to open the project to auto create it the first time.

We solved this by checking the shared box under manage schemes. This moves the schemes out from under your individual xcuserdata into a shared folder that can be committed via source control and used by the continuous build servers. Hope this helps.

like image 185
Bill Burgess Avatar answered Oct 24 '22 05:10

Bill Burgess


This folder just contains some temporary information. Like the UI state of Xcode and similar properties. It is recommended by GitHub to exclude the xcuserdata folder in the .gitignore file.

like image 45
miho Avatar answered Oct 24 '22 05:10

miho