什么是 Xcode 项目中的“UserInterfaceState.xcuserstate”文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9028118/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 04:13:49  来源:igfitidea点击:

What is "UserInterfaceState.xcuserstate" file in Xcode project?

xcodesvnversion-controlcommit

提问by ChangUZ

I use svnX.

我使用 svnX。

When importing project, I check "no ignore" option. (for importing libOAuth.a, ...)

导入项目时,我选中“不忽略”选项。(用于导入 libOAuth.a,...)

But one file is causing a small problem.

但是一个文件导致了一个小问题。

UserInterfaceState.xcuserstate

UserInterfaceState.xcuserstate

What is this file?

这个文件是什么?

Can I ignore this file? Is it important? Should I commit this file?

我可以忽略这个文件吗?那很重要么?我应该提交这个文件吗?

回答by justin

What is this file?

这个文件是什么?

You can open it in property list editor and have a look -- It stores things like your workspace/project document layouts, nothing you would lose sleep over if lost.

您可以在属性列表编辑器中打开它并查看 - 它存储诸如您的工作区/项目文档布局之类的内容,如果丢失,您将无法入睡。

Can I ignore this file?

我可以忽略这个文件吗?

You would ignoreit in all but exceptional cases. It's easily reconstructed, and should be considered local to your system's user account. To stretch imagination or reason to track it: If you worked by yourself and mirrored your user accounts, then you might want this information synchronized among your machines. Sure, you couldtrack it, but it would produce a lot of unnecessary revision control noise.

ignore除了特殊情况外,您都会这样做。它很容易重建,并且应该被视为本地系统用户帐户。扩展想象力或跟踪它的理由:如果您自己工作并镜像您的用户帐户,那么您可能希望这些信息在您的机器之间同步。当然,你可以跟踪它,但它会产生很多不必要的修订控制噪音。

回答by rob mayoff

I recommend ignoring files that match these patterns:

我建议忽略与这些模式匹配的文件:

*.xcuserstate
project.xcworkspace/
xcuserdata/

Basically, the only thing under MyProject.xcodeprojthat you want checked in is project.pbxproj.

基本上,MyProject.xcodeproj您想要签入的唯一内容是project.pbxproj.

回答by Benjamin Van Citters

As of Xcode 7.3.1, UserInterfaceState.xcuserstate's are binary-formatted plist files that can exist in either of project files or workspace files. They are user-specific and many can be present in a given Xcode project or workspace.

从 Xcode 7.3.1 开始,UserInterfaceState.xcuserstate 是二进制格式的 plist 文件,可以存在于项目文件或工作区文件中。它们是特定于用户的,并且许多可以出现在给定的 Xcode 项目或工作区中。

Among other things they contain the current target your project is set to, the currently open file, and cursor position. These files can be saved to disk frequently if Xcode has the associated project open.

其中包括项目设置的当前目标、当前打开的文件和光标位置。如果 Xcode 已打开关联的项目,则可以将这些文件频繁保存到磁盘。

To convert the contents of the binary plist files to a more human-readable XML format you can use this plutilcommand in the terminal:

要将二进制 plist 文件的内容转换为更易读的 XML 格式,您可以在终端中使用此plutil命令:

plutil -convert xml1 UserInterfaceState.xcuserstate

These files can safely be ignored in most cases.

在大多数情况下,可以安全地忽略这些文件。