简体   繁体   English

Xcode不断扩展项目导航器中的所有组

[英]Xcode keeps expanding all groups in the project navigator

Since a couple days ago Xcode keeps expanding all the groups and subgroups in the project navigator. 几天前,Xcode不断扩展项目导航器中的所有组和子组。

I have repeatedly collapsed them so I can focus on what I'm working on and then I go back and they're all expanded again. 我一再崩溃,所以我可以专注于我正在做的事情,然后我回去,他们都会再次扩大。

Has anyone else experienced this? 还有其他人经历过这个吗?

I collapse a group, move to a different tab in Xcode and then back and the groups are all expanded again. 我折叠了一个组,移动到Xcode中的另一个选项卡,然后返回,所有组都再次展开。

It's really frustrating as I keep losing track of the files I'm working with. 当我不断跟踪我正在使用的文件时,这真的令人沮丧。

OK, I had had enough of this now and decided to try several things out. 好的,我现在已经受够了,并决定尝试一些事情。

Xcode had got to the stage where the project navigator was just broken. Xcode已经到了项目导航器刚破坏的阶段。 I couldn't collapse (permanently) and groups and I couldn't move files around or anything. 我无法崩溃(永久)和群组,我无法移动文件或任何东西。

In the end what fixed it was deleting the .xcuserstate file and restarting Xcode. 最后修复它的是删除.xcuserstate文件并重新启动Xcode。

I lost my tabs and everything but setting them back up took a couple seconds and everything is working fine now. 我丢失了我的标签,除了设置它们之外的一切都花了几秒钟,现在一切正常。

I also was experiencing this annoying scenario in Xcode 9.2 where the project groups kept expanding themselves. 我也遇到了Xcode 9.2中令人烦恼的情况,项目组不断扩展自己。

To fix it: 要解决这个问题:

First, close your project in Xcode. 首先,在Xcode中关闭您的项目。 (Otherwise, Xcode will replenish this file upon closing the project.) (否则,Xcode将在关闭项目时补充此文件。)

Then delete the following file (or move the file somewhere else): [MyProject].xcodeproj/project.xcworkspace/xcuserdata/[MyUser].xcuserdatad/UserInterfaceState.xcuserstate 然后删除以下文件(或将文件移动到其他位置): [MyProject].xcodeproj/project.xcworkspace/xcuserdata/[MyUser].xcuserdatad/UserInterfaceState.xcuserstate

Remember to use the "Show Package Contents" option in Finder. 请记住在Finder中使用“显示包内容”选项。

扩展/折叠所有Xcode的组文件夹的一个很好的快捷方式是cmd +单击任何组箭头

I wrote a shell script that gets rid of all these garbage files that sometimes make problems in xcode: 我写了一个shell脚本,摆脱了有时在xcode中出现问题的所有垃圾文件:

printf '\33c\e[3J'

RED=`tput setaf 1`
BLUE=`tput setaf 4`
NOCOLOR=`tput sgr0`

BASEDIR=$(dirname "$0")
path1="prj.xcodeproj/xcuserdata"
path2="prj.xcworkspace/xcuserdata"

echo "${BLUE}[XCode cache files pruner, created by Deya Eldeen Elkhawaldeh]${NOCOLOR}"
echo "REMOVING ${NOCOLOR} $BASEDIR/${RED}$path1${NOCOLOR}"
rm -R "$BASEDIR/$path1/"
echo "REMOVING ${NOCOLOR} $BASEDIR/${RED}$path2${NOCOLOR}"
rm -R "$BASEDIR/$path2/"

echo "${BLUE}Done,${NOCOLOR}"

it's hosted in github, maybe someday I will update it with more features, https://github.com/deya-eldeen/XCodeProjectCleaner 它是在github中托管的,也许有一天我会用更多功能更新它, https://github.com/deya-eldeen/XCodeProjectCleaner

In my case, I accidentally selected "Show only files with source control status" option in "project navigator". 就我而言,我偶然在“项目导航器”中选择了“仅显示具有源控制状态的文件”选项。 Check if you also selected this. 检查您是否也选择了这个。 Unselecting this option resolved my issue. 取消选择此选项解决了我的问题。 Noticed this after searching for many answers on SO. 在SO上搜索了很多答案后注意到这一点。

I had a similar issue in a workspace with an SPM and an iOS project. 我在带有SPM和iOS项目的工作区中遇到了类似的问题。 The groups' state would be reset to an older expansion state whenever I switched navigators. 每当我切换导航器时,组的状态将重置为较旧的扩展状态。 What worked for me was to perform a minor group change that caused the project to enter a staging state in version control. 对我有用的是执行一个小的组更改,导致项目在版本控制中进入暂存状态。 I then discarded the change in the project and that reset the entire group expansion state. 然后我放弃了项目中的更改并重置了整个组扩展状态。 The problem disappeared ever since. 从那以后问题就消失了。

For me, it was that I had accidentally typed into the project-navigator text filter at the bottom (random keystroke), with a common letter that caused all folders to expand. 对我来说,就是我不小心输入了底部的项目导航器文本过滤器(随机击键),其中包含一个导致所有文件夹扩展的公用字母。

Deleting the user data didn't seem to reset that, I just had to finally notice it and clear the search filter. 删除用户数据似乎没有重置,我只需要最终注意它并清除搜索过滤器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM