打开项目文件时 Xcode 崩溃

发布于 2024-10-07 16:06:20 字数 951 浏览 3 评论 0原文

当我打开项目文件时,Xcode 不断崩溃。我已经能正常打开它好几个星期了。不知道如何诊断。它仅针对特定项目而崩溃。

Process:         Xcode [1293]
Path:            /Developer/Applications/Xcode.app/Contents/MacOS/Xcode
Identifier:      com.apple.Xcode
Version:         3.2.5 (1760)
Build Info:      DevToolsIDE-17600000~5
Code Type:       X86-64 (Native)
Parent Process:  launchd [189]

Date/Time:       2010-12-15 16:05:24.659 -0700
OS Version:      Mac OS X 10.6.5 (10H574)
Report Version:  6

Interval Since Last Report:          201 sec
Crashes Since Last Report:           4
Per-App Interval Since Last Report:  80 sec
Per-App Crashes Since Last Report:   4
Anonymous UUID:                      2B7F7CFC-45EA-450C-8467-6BF1E356B6F6

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000025940
Crashed Thread:  10  Dispatch queue: com.apple.Xcode.index-access

Application Specific Information:
objc[1293]: garbage collection is ON

Xcode keeps crashing on me when I open my project file. I've been able to open it fine for weeks now. Not sure how to diagnose. It only crashes for a specific project.

Process:         Xcode [1293]
Path:            /Developer/Applications/Xcode.app/Contents/MacOS/Xcode
Identifier:      com.apple.Xcode
Version:         3.2.5 (1760)
Build Info:      DevToolsIDE-17600000~5
Code Type:       X86-64 (Native)
Parent Process:  launchd [189]

Date/Time:       2010-12-15 16:05:24.659 -0700
OS Version:      Mac OS X 10.6.5 (10H574)
Report Version:  6

Interval Since Last Report:          201 sec
Crashes Since Last Report:           4
Per-App Interval Since Last Report:  80 sec
Per-App Crashes Since Last Report:   4
Anonymous UUID:                      2B7F7CFC-45EA-450C-8467-6BF1E356B6F6

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000025940
Crashed Thread:  10  Dispatch queue: com.apple.Xcode.index-access

Application Specific Information:
objc[1293]: garbage collection is ON

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(22

冷情 2024-10-14 16:06:20

崩溃通常表明项目文件已损坏。以下列出了您可以采取的措施来尝试修复该问题。

损坏的 *.pbxproj 文件

1. 修复由合并冲突引起的

如果您正在使用版本控制,则可能是由尚未解决的合并冲突引起的。

  1. 使用 Finder 打开保存项目的目录。
  2. 右键单击项目文件 YOUR_PROJECT_NAME.xcodeproj 并使用您首选的文本编辑工具(例如 Sublime Text)打开方式
  3. 查找通常使用一系列 ========== 条标记的合并冲突。
  4. 手动解决合并冲突或删除一侧的更改。

由不可读的 XML 引起

如果失败,请进入文件并快速滚动查看是否有任何内容不合适 - 它通常应该是可读的 XML。您甚至可以尝试使用 XML 验证器来检查是否发现任何问题。

2. 重置工作区

  1. 使用 Finder 打开包含项目的目录。
  2. 右键单击项目文件 MyProject.xcodeproj 并选择显示包内容
  3. 删除 xcuserdata 文件夹,其中应包含一个带有您的用户名的文件夹。
  4. 对工作区文件 MyProject.workspace 重复步骤 2 和 3

KennyWinker 和 Paul R 下面的答案。

3. 重新创建您的 Xcode 项目

注意这应该是您最后的手段,因为对于大型项目来说这非常乏味。

最后您可以简单地重新创建它。这可能看起来很痛苦,但基本上您可以创建一个新项目并将“Classes”文件夹下的所有内容拖到 Xcode 中以开始使用它(不要忘记还添加您需要的框架)。

The crash is generally a sign the project file has been corrupted. Here's a list of possible things you can do to try to fix it.

1. Fix a corrupted *.pbxproj file

Caused by a merge conflict

If you are using version control, it might be caused by a merge conflict that has not yet been resolved.

  1. Using Finder, open the directory that holds your project.
  2. Right click the project file YOUR_PROJECT_NAME.xcodeproj and Open With your preferred text editing tool such as Sublime Text.
  3. Look for merge conflicts which are usually marked using a series of ========= bars.
  4. Resolve the merge conflicts manually or remove the changes of one side.

Caused by unreadable XML

If that fails go into the file and quickly scroll through to see if anything seems out of place - it should generally be readable XML. You could even try an XML validator against it to see if anything amiss was found.

2. Reset your workspace

  1. Using Finder, open the directory that holds yor project.
  2. Right click the project file MyProject.xcodeproj and choose Show Package Contents.
  3. Delete the xcuserdata folder, which should contain a folder with your username on it.
  4. Repeats step 2 and 3 for your workspace file MyProject.workspace

As elaborated by KennyWinker and Paul R on the answers below.

3. Recreate your Xcode project

Note that this should be your last resort as it is quite tedious to do for large projects.

Lastly you could simply re-create it. That might seem like a big pain, but basically you could just create a new project and drag everything under the "Classes" folder into Xcode to start using it (don't forget to also add the frameworks you need).

奢华的一滴泪 2024-10-14 16:06:20

只是想澄清@Paul R 的评论。

我遇到过这样的情况:每次打开项目文件时 Xcode 都会崩溃。它似乎连接到正在打开的 IB 窗口。最后它删除了 MyProject.xcodeproj/project.xcworkspace/xcuserdata/ 的内容解决了这个问题。它通过重置工作区(打开文件、窗口缩放等)来做到这一点。

希望这有帮助。

Just wanted to elucidate on @Paul R's comment.

I had a situation where Xcode was crashing every time I opened a project file. It seemed to be connect to the IB window that was opening. In the end it was deleting the contents of MyProject.xcodeproj/project.xcworkspace/xcuserdata/ that solved this. It did this by resetting the workspace (open files, window scaling, etc.)

Hope this is helpful.

杀お生予夺 2024-10-14 16:06:20

什么对我有用?

对我有用的唯一解决方案是删除挂起项目的派生数据文件夹,即上述目录中的派生数据文件夹:~/Library/Developer/Xcode/派生数据/。希望它能帮助某人。

什么没有?

正如其他地方提到的,删除 MyProject.xcodeproj/project.xcworkspace/xcuserdata/MyProject.xcodeproj/xcuserdata/不适合我。

What worked for me?

The only solution that worked for me was deleting the derived data folders of the hanging project, i.e the derived data folders in above directory: ~/Library/Developer/Xcode/DerivedData/. Hope it helps someone.

What didn't?

As mentioned at other places, deleting MyProject.xcodeproj/project.xcworkspace/xcuserdata/ or MyProject.xcodeproj/xcuserdata/ didn't work for me.

黄昏下泛黄的笔记 2024-10-14 16:06:20

只是想在 @Kenny Winker 答案中添加一些额外的内容...

要删除您的 Xcode 用户数据,

  • 请找到您的 Xcode 项目文件,例如:MyProject.xcodeprojMyProject.xcworkspace
  • 右键单击它并选择显示包内容
  • 最后,只需删除文件夹xcuserdata内的所有内容
  • 即可完成! :)

希望这能为那些不知道在哪里可以找到项目用户数据的人们提供更多背景信息。

Just wanted add some extra content to @Kenny Winker answer...

To delete your xcode user data go,

  • Find your Xcode project file ex: MyProject.xcodeproj or MyProject.xcworkspace
  • Right click on it and choose Show Package Contents
  • Finally, just delete everything inside the folder xcuserdata
  • Done! :)

Hopefully, this adds a bit more context to people who doesn't know where to find their project user data.

懵少女 2024-10-14 16:06:20

我在 Xcode 8.1 中也遇到了类似的问题。原因可能是项目文件包含合并冲突数据。
您可以通过在 TextEdit 中打开 Xcode 项目文件来删除它。

但是,就我而言,没有合并冲突。只需删除 DerivedData 的内容对我来说很有效。

步骤:

  1. 打开查找器窗口,然后选择Go Tab ->转到文件夹...(或按 Cmd + shift + G)

Screenshot 1

  1. 输入 ~/Library 并按 Go。这将打开默认情况下隐藏的库文件夹。

屏幕截图 2

  1. 转到开发人员 -> Xcode-> DerivedData 文件夹。 删除该文件夹的所有内容。
    DerivedData 就像缓存,即每次构建/运行应用程序时创建的缓存。

屏幕截图 3

  1. 现在打开项目。它应该可以正常工作。

I had similar problem with Xcode 8.1. The reason maybe the project file contains merge conflict data.
You can remove this by opening Xcode project file in TextEdit.

However, in my case there was no merge conflict. Simply deleting content of DerivedData worked for me.

Steps :

  1. Open finder window then select Go Tab -> Go to Folder… (or press Cmd + shift + G)

Screenshot 1

  1. Enter ~/Library and press Go. This opens Library folder which is hidden by default.

Screenshot 2

  1. Go to Developer -> Xcode -> DerivedData folder. Delete all the content of this folder.
    The DerivedData is like cache i.e. create every time you build/run your app.

Screenshot 3

  1. Now open the project. It should work with no issues.
夏日浅笑〃 2024-10-14 16:06:20

复制@Sean D 的答案,这对我有用。

看到这里的建议后,我通过删除 Xcode 的首选项解决了这个问题。最可靠的方法是退出 Xcode 后发出以下终端命令:

defaults delete com.apple.dt.Xcode

ETA:其他建议涉及更改或删除某些个人首选项设置,但在尝试了其中一些之后,没有一个对我有用。 6 和 7b3 之间的首选项似乎存在多种不兼容性,因此完全废弃首选项应该可以解决所有问题。

Copying Answer of @Sean D which worked for me.

After seeing a suggestion here, I solved this issue by deleting Xcode's preferences. The most reliable way to do that is the following terminal command, issued after quitting Xcode:

defaults delete com.apple.dt.Xcode

ETA: Other suggestions have involved changing or removing certain individual preference settings, but after trying a few of those, none worked for me. There seem to be multiple incompatibilities in the preferences between 6 and 7b3, so trashing the prefs entirely should work around them all.

無處可尋 2024-10-14 16:06:20

我做了线程上的每个解决方案。但没有任何帮助我。不知道为什么。

我没有通过 Xcode 打开项目,而是使用 open Project.xcworkspace 通过终端打开项目,它神奇地工作了。

I did every solution on the thread. But nothing helped me. Don't know why.

Instead of opening the project through Xcode, I opened the project through the terminal using open Project.xcworkspace, it magically works.

ぃ弥猫深巷。 2024-10-14 16:06:20

我也面临同样的问题,我做了如下的所有事情,但对我不起作用!

删除派生数据:

~/Library/Developer/Xcode/DerivedData/

删除文件夹 xcuserdata 中的所有内容:
MyProject.xcodeproj/project.xcworkspace/xcuserdata/

MyProject.xcodeproj/xcuserdata/

什么对我有用?

就我而言,我从下面的链接重新安装了附加组件(附加下载),然后解决了这个问题。
https://developer.apple.com/xcode/resources/

I was also facing same issue, I did every things like below but didn't work for me!

Deleting the derived data:

~/Library/Developer/Xcode/DerivedData/

Delete everything inside the folder xcuserdata:
MyProject.xcodeproj/project.xcworkspace/xcuserdata/
and
MyProject.xcodeproj/xcuserdata/

What worked for me?

In my case I have reinstalled Additional Component(Additional downloads) from below link then solved this issue.
https://developer.apple.com/xcode/resources/

画▽骨i 2024-10-14 16:06:20

同样的事情也发生在我身上,这是某种我无法修复的版本控制问题,所以我恢复到以前的版本并且它起作用了。感觉 XCode 4 中还有一些错误需要解决。

Same thing happened to me, and it was some sort of versioning issue that I couldn't fix, so I reverted back to a prior version and it worked. Feels like there are a few bugs in XCode 4 that still need to be worked out.

软糯酥胸 2024-10-14 16:06:20

在您的项目文件夹中找到projectName.xcodeproj或projectName.xcworkspace(如果您已安装pod)右键单击它并单击(显示包内容),最后删除xcuserdata文件夹中的所有内容
启动你的项目它会正常工作

Inside your project folder find projectName.xcodeproj or projectName.xcworkspace if you have installed pods right click on it and click on (Show package contents) and finally delete everything inside xcuserdata folder
Launch your project it will work fine

ゃ人海孤独症 2024-10-14 16:06:20

每次打开 Images.xcassets 时,XCode 都会崩溃。解决方案是删除我刚刚添加的损坏的 PDF 文件。

I had XCode crashing every time I opened Images.xcassets. The solution was to delete a corrupt PDF file I had just added.

寄与心 2024-10-14 16:06:20

计算机重新启动

对我来说有效。虽然

xcuserdata deletion

对我来说

defaults delete com.apple.dt.Xcode

不起作用

我什至无法单独打开 xcode 或我的任何项目或单个 .m 文件。

Computer restart

worked for me. While

xcuserdata deletion

and

defaults delete com.apple.dt.Xcode

didn't work for me.

I even was not able to open xcode alone or any of my projects or single .m file.

吃不饱 2024-10-14 16:06:20

如果您在新窗口中打开了任何 swift 文件(例如,当您双击 xCode 中的 .swift 文件,它会在新窗口中打开),那么当 xCode 打开时,这可能是一个问题。我想我在关闭 xCode 时打开了这个窗口,然后在打开 xCode 时该窗口再次打开,并且由于某种原因导致 xCode 崩溃。尝试在打开的窗口崩溃之前快速关闭它。奇怪,但这对我有用。

If you have any open swift file in a new window (for example when you double click on a .swift file in xCode and it opens in a new window) when xCode opens this might be an issue. I think I had this window opened when closing xCode, then when opening xCode this window opens up again and for some reason crashes xCode. Try to close that open window quickly before it crashes. Strange, but that worked for me.

德意的啸 2024-10-14 16:06:20

我测试了很多方法,但毕竟我只是改变了我的项目位置的目录,所有的东西都修复了,我的 Xcode 工作正常,我现在很高兴......

i tested a lot of ways but after of all i just and only change the directory of my project location every thing fixed and my Xcode works properly and I'm glad now....

尽揽少女心 2024-10-14 16:06:20

当我尝试编辑特定的original.m 文件时,我遇到了 XCode 崩溃的情况。上述解决方案都不起作用,但这样做了:

  1. 创建一个新的 .m 文件,例如 new.m 。
  2. 使用文本编辑器在XCode外部打开original.m,复制内容并粘贴到XCode内部的new.m中。返回到 XCode 中工作。
  3. 删除并移动到垃圾箱原来的.m
  4. 将new.m 重命名为original.m
  5. 现在我可以编辑original.m 而不会导致XCode 崩溃。

I experienced XCode crashing when trying to edit a specific original.m file. None of the above solutions worked, but this did:

  1. Create a new .m file as new.m for example.
  2. Using a text editor open up original.m outside XCode, copy contents and paste into new.m inside XCode. Go back to working in XCode.
  3. Delete and move to trash the original.m
  4. Rename new.m to original.m
  5. Now I can edit original.m without XCode crashing.
漫漫岁月 2024-10-14 16:06:20

就我而言,有两个窗口,一个在 MacBook 的内部屏幕上,一个在外部屏幕上,每个窗口在 Xcode 崩溃之前打开了几个选项卡,并且在尝试打开 xcworkspace 文件时不断崩溃。上述解决方案不起作用。断开外部显示器的连接后,Xcode 启动时没有崩溃,两个窗口都放置在 MacBook 的屏幕上。重新连接显示器,一切都像以前一样工作。

In my case there were two windows, one on the internal screen of my MacBook and one on an external each with several tabs opened before Xcode crashed and kept crashing on trying to open the xcworkspace file. The above mentioned solutions did not work. After disconnecting the external display, Xcode started without crashing and both windows were placed on the MacBook's screen. Reattached the display and everything worked as before.

活雷疯 2024-10-14 16:06:20

如果您使用 Cocoapods,请尝试 pod deintegrate,删除工作区,然后 pod install。这在这里解决了这个问题(谈论将 Mac 升级到 Catalina 后的 Xcode 11.2.1 以及以下崩溃的 Xcode)

I you use Cocoapods try pod deintegrate, delete the workspace, then pod install. This cured it here (Talking of Xcode 11.2.1 after upgrading the Mac to Catalina and the following crashing Xcode)

青柠芒果 2024-10-14 16:06:20

对于包含可可豆荚的项目,我通过重命名工作区文件并再次在终端上运行“pod install”解决了这个问题。

Towards a cocoa pods included project, I resolved this issue by renaming workspace file and running "pod install" on terminal again.

黑色毁心梦 2024-10-14 16:06:20

我也遇到了同样的问题,每次 xcode 都会崩溃。我重新启动了 mac,清除了派生数据/xcuserdata,但没有任何效果。

我还有一个存储库,因此我从那里复制了“project.xcodeproj”文件并将其粘贴到当前存储库中,这一技巧解决了我的问题。

I was also facing same issue, everytime xcode was crashing. i restarted mac, cleared derived data/xcuserdata but nothing worked.

I had one more repo so i copied 'project.xcodeproj' file from there and paste it in current repo, this trick resolved my problem.

渡你暖光 2024-10-14 16:06:20

进入项目->右键单击 .xcodeproj ->显示包装内容 ->删除 xcuserdata 中的所有文件。
退出 xcode ->重新打开

删除 “在此处输入图像描述"

Go to project -> right click on .xcodeproj -> show package contents -> delete all files in xcuserdata.
Quit the xcode -> reopen

Delete the enter image description here

弃爱 2024-10-14 16:06:20

在以前版本的 Xcode 中打开项目,然后关闭它并在您用于项目的 Xcode 版本上重新打开它,
假设您使用的是 Xcode 11.1,并且在打开项目时崩溃,然后在 Xcode 10.0 或 10.1 中打开它。

Open project in previous version of Xcode and then close it and reopen it on Xcode version that you are using for project,
suppose you are using Xcode 11.1 and it is getting crashed while opening projects, then open it in Xcode 10.0 or 10.1.

一指流沙 2024-10-14 16:06:20
  1. 修复损坏的 *.pbxproj 文件
  2. 重置工作区

  3. 默认删除 com.apple.dt.Xcode

执行 1~ 3和

git clone ~~~.git newGitProject

复制 MyProject.xcodeproj,MyProject.xcworkspace

转到GitProject

粘贴 MyProject.xcodeproj,MyProject.xcworkspace

为我工作。

如果你有 git 存储库,请尝试一下;)

  1. Fix a corrupted *.pbxproj file
  2. Reset your workspace

  3. defaults delete com.apple.dt.Xcode

do 1~3 and

git clone ~~~.git newGitProject

copy MyProject.xcodeproj, MyProject.xcworkspace

go to GitProject

paste MyProject.xcodeproj, MyProject.xcworkspace

worked for me.

if you have git repository , try it ;)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文