本文介绍了如果使用Launch Arguments,忽略/ xcuserdata / with Git是否安全?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在启动时传递了一个参数: -D DEBUG 它允许我在发布应用程序中使用以下内容:

  #ifndef DEBUG 
/ *我只想在使用发布应用时运行一些代码* /
#endif

当我运行 git status 时,它显示文件在添加 -D DEBUG MyExampleProject.xcodeproj / xcuserdata / myusername.xcuserdatad / xcschemes / MyExampleProject.xcscheme



应该使用常用的Xcode 排除这些内容。是否有其他方式可以包含符合 .gitignore 且不依赖于我的用户帐户 xcuserdata

解决方案

通常,xcuserdata可以安全地忽略个别项目。每个用户都有自己的文件,可以保存userstate,打开文件夹,打开最后一个文件等等。它确实包含你的计划。如果这是第一次打开和文件不存在,Xcode会为您创建它。然而,我们在办公室遇到了这个问题,当你有一个像Hudson或Jenkins一样的连续构建服务器时,不需要从Git或SVN复制源代码永远打开它,并试图建立它。如果您忽略此文件,则不会构建任何方案,或者强制某人打开该项目以自动创建它。



我们通过以下方法解决了这个问题:检查管理方案下的共享框。这将这些方案从个人xcuserdata下移出到一个共享文件夹中,该文件夹可以通过源代码控制提交并由连续构建服务器使用。希望这有助于。


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?

解决方案

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.

这篇关于如果使用Launch Arguments,忽略/ xcuserdata / with Git是否安全?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-21 23:30