iOS:svn 忽略 xcworkspace、xcuserdata文件

本文介绍了iOS项目中project.xcworkspace和xcuserdata目录的用途。xcworkspace包含工作区信息,而xcuserdata存储个人设置,如断点和布局。在源代码管理中,xcuserdata通常被忽略,而xcshareddata则应受控。在不共享工作区或使用简单工作区的环境中,可以忽略这些文件,但在共享项目配置的工作区中,可能需要保留它们。提供了两种svn设置忽略属性的方法,但第二种方法的效果不确定。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

        说明:     

          project.xcworkspace说明:is a directory of files describing the workspace or projects. Although some of the answers here indicate it is unnecessary and should be ignored for source control, I don't agree, but it's going to be highly dependent upon how you use your environment. Generally, the contents of the project.xcworkspace directory contains the contents.xcworkspace data file, which lists the projects that are included as top-level entities in your project。

          xcuserdata说明:You can safely delete the xcuserdata directories. It basically contains personal settings like breakpoints, user interface layout, open files, automatic snapshots configuration and so on。

         结论:

         an xcuserdata directory, which contains each user's settings (should be ignored for source code controL), and xcshareddata, which is data shared by users who share a project, and should be under source control.

         in environments where you don't share workspaces, or where you use simple workspaces, you can ignore these as well, however in environments where you put related projects in the same workspace and share that configuration, you may well want to keep these.

        解决办法:

        1.svn设置忽略属性:

svn propset svn:ignore xcuserdata path/to/my/folder/MyProject.xcodeproj
        说明:If you want to ignore a directory files, you need to svn propset svn:ignore files on its PARENT directory, not the directory itself.
# your directory structure is this:
# workingCopy
# workingCopy/parent
# workingCopy/parent/subfolder
# to ignore subfolder do this:
svn propset svn:ignore subfolder workingCopy/parent
       或者方式2:
1.cd ~/工程目录/工程名字.xcodeproj/project.xcworkspace/xcuserdata/用户名.xcuserdatad
2.svn rm --force UserInterfaceState.xcuserstate [如果svn命令不能执行,请安装xcode中的命令行工具或用Spotlight查找svn所在]
   svn update [可能需要]
   svn commit -m "忽略该死的UserInterfaceState.xcuserstate"
3.export EDITOR=nano [注释:这是bash下]
4.svn propedit svn:ignore . [注意后面有个点号,代表本目录]
5.第4步执行完了会弹出nano编辑界面,复制粘贴UserInterfaceState.xcuserstate后按Ctrl+X输入Y保存即可.
6.输入svn status就发现不显示UserInterfaceState.xcuserstate了.证明修改成功.
      2.修改配置文件

global-ignores = *.o *.lo *.la .*.rej *.rej .*~ *~ .#* .DS_Store *~.nib *.mode* *.pbxuser CVS _*.java *.perspective .LSOverride *.xcuserdatad 
备注:

--第一种方法:提示svn版本问题,具体效果怎么样不确定;

--第二种方法:试了貌似不好用。

        

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值