Xcode quits unexpectedly every time I open my project
Xcode stores some user state information inside the Xcode project “file”, which is really a folder. That state information might have become corrupted. You can normally throw away everything inside your .xcodeproj
folder except the project.pbxproj
file. This might fix your problem.
Open up the folder containing your .xcodeproj
file. Right-click or control-click the .xcodeproj
file and choose “Show Package Contents”. Then throw away everything except the project.pbxproj
file.
If you know what an Xcode workspace is, and you're actually making use of it, you might not have a project.xcworkspace
file to throw away, or you might not want to throw it away. But if you don't know what an Xcode workspace is, then you're not using it so you can just throw away project.xcworkspace
. Xcode will recreate it automatically.
Xcode Error Report Xcode quit unexpectedly
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:
//.xcodeproj/project.xcworkspace/xcuserdata/.xcuserdatad/UserInterfaceState.xcuserstate
Just remove the file e.g. via rm
and Xcode shall work again.
Xcode Crashing When Opening Project File
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.
- Using Finder, open the directory that holds your project.
- Right click the project file
YOUR_PROJECT_NAME.xcodeproj
andOpen With
your preferred text editing tool such as Sublime Text. - Look for merge conflicts which are usually marked using a series of
=========
bars. - 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
- Using Finder, open the directory that holds yor project.
- Right click the project file
MyProject.xcodeproj
and chooseShow Package Contents
. - Delete the
xcuserdata
folder, which should contain a folder with your username on it. - 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).
Xcode crashing on a specific project
Do one thing, clear off/delete all the derived data for Xcode and then open your project. That should fix the issue.
Also to report a bug to Apple you can simply go to https://bugreporter.apple.com/ and login with apple credentials and and they'd get back to you in like couple of days.
Also for derived data do the following:
You can go to File > Workspace Settings
if you are in a workspace environment or File > Project Settings
for a regular project environment.
Then click over the little grey arrow under Derived data section and select your project folder to delete it.
Related Topics
Property Not Working with Getter and Setter
How to Dismiss the Keyboard When Editing a Uitextfield
Detect First Launch of iOS App
How to Display .Svg Image Using Swift
Xcode Is Looking for Core Data Entity Names with Dot; Not Compiling
iOS App Error - Can't Add Self as Subview
Using Iskindofclass with Swift
Linker Command Failed with Exit Code 1 (Use -V to See Invocation), Xcode 8, Swift 3
Capturing and Storing a Picture Taken with the Camera into a Local Database/Phonegap/Cordova/Ios
Retrieve Custom Prototype Cell Height from Storyboard
Uiscrollview: Paging Horizontally, Scrolling Vertically
Given a View, How to Get Its Viewcontroller
Toggling Privacy Settings Will Kill the App