8

After updating Xcode to 11.2.1 I am unable to open my project. Everytime I try to open it Xcode crashes and I get the following error.

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
ProductBuildVersion: 11B500
ASSERTION FAILURE in /Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-15526.1/IDEKit/Workspace/IDEWorkspaceDocument.m:3429
Details:  selection failed. window:<IDEWorkspaceWindow: 0x7f95c63dfb70> currentlySelectedTabbedWindow:<IDEWorkspaceWindow: 0x7f95c7c51350>
Object:   <IDEWorkspaceDocument: 0x7f95c60d7580>
Method:   -_restoreSelectedTabsByIdentifierFromStateSaving:
Thread:   <NSThread: 0x7f95c0703790>{number = 1, name = main}
Paul Wasilewski
  • 9,762
  • 5
  • 45
  • 49
Andre
  • 115
  • 6
  • 1
    Hi Andre, please see my answer and let me know if it helped - https://stackoverflow.com/questions/58844184/xcode-11-2-1-crashes-when-opening-a-project/58844362#58844362 – shbedev Nov 17 '19 at 17:07

2 Answers2

18

It seems that Xcode cannot restore the tabs / files you have opened the last time see Method: -_restoreSelectedTabsByIdentifierFromStateSaving:.

The latest ui state including opened files, curent target etc. is stored in the UserInterfaceState.xcusertate. You can find the file in your Xcode project folder under:

/<your_project_path>/<your_project_name>.xcodeproj/project.xcworkspace/xcuserdata/<username>.xcuserdatad/UserInterfaceState.xcuserstate

Just remove the file e.g. via rm and Xcode shall work again.

Paul Wasilewski
  • 9,762
  • 5
  • 45
  • 49
  • I've spent all day trying to find a solution and this fixed it! I'm absolutely over the moon. Thank you! I'm curious, how are you so familiar with the internals of Xcode? – Dyldo42 Nov 18 '19 at 04:58
  • 1
    From a terminal window typing the following is an easy way remove the offending file from all your projects: find . -name "UserInterfaceState.xcuserstate" -exec rm {} \; – One In a Million Apps Nov 18 '19 at 16:23
  • Thank you! I have tried to delete whole folder but then also it was not working bt after follow this, this works well, But can you explain why this happen nd also why this happen only for specific project because all other projects are working well ? – JAY RAPARKA Mar 26 '20 at 04:02
  • 1
    It did not work when I removed `xcuserdata`, but I did the clean project's clone and replaced `ios/theftpatrol.xcworkspace` in my broken project and I could open the project! Your steps helped me a lot, thank you! – Chaki_Black Feb 01 '21 at 19:56
  • I am confused. My *. xcodeproj is not a directory, but you are listing it like it is a path... – Scorb Feb 02 '21 at 02:39
  • @ScottF, it's a file. Either you access the directory content via the terminal or you can open the directory (in Finder) by right click on the file icon > Show Package Contents. – Paul Wasilewski Feb 03 '21 at 19:52
5

Open project folder show package contents from .xcworkspace or .xcodeproj You will see 2 folders xcshareddata and xcuserdata Please remove xcuserdata folder Try to open application Xcode will work properly

Nitin
  • 497
  • 3
  • 8