59

After opening xcode, when I open my current project, it's showing a warning like "xcode quit unexpectedly" with 3 options: "Ignore", "Report" and "Reopen". When I click "Reopen", it will open the xcode window and again automatically it will close and show the same warning.

Why this is happening? If I open any other projects, then it opens with no issues; the issue is with my current app.

versions:

  • xcode is 4.3.1
  • mac OS X version is 10.7.3

Please tell me why it's happening like this.

Jeff Schaller
  • 2,352
  • 5
  • 23
  • 38
suvarna
  • 697
  • 2
  • 7
  • 10
  • rewove all user data from the project and try again. also, provide some error message - otherwise no one will be able to help you. – jimpic Nov 28 '12 at 07:36
  • Try deleting DerivedData folder of your Current App. It should be located somewhere in ~/Library/Developer/Xcode/DerivedData/CurrentApp-{some generated string}/ – Eimantas Nov 28 '12 at 07:37
  • I tried this but no result ..Same problem...shal i post problem report?? – suvarna Nov 28 '12 at 08:01

16 Answers16

151

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.

cleaning an xcodeproj package

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.

rob mayoff
  • 375,296
  • 67
  • 796
  • 848
19

Deleting Derived Data worked for me. Just open another project or open xcode without opening your corrupted project. Than open preferences and go locations tab at the end. Click gray circle with arrow (where all your projects derived data are saved.)enter image description here

Delete your corrupted project's derived data in there and you are good to go.

ysnzlcn
  • 558
  • 6
  • 18
7

you can run XcodeSystemResources.pkg.

/Applications/Xcode.app/Contents/Resources/Packages/XcodeSystemResources.pkg.

I hope help to you

Tolga İskender
  • 158
  • 2
  • 14
6

go to [ProjectName].xcworkspace file.Right click. Show package contents. Delete xcuserdata folder. After deleting, run the project it will work for sure.

Amit Thakur
  • 1,081
  • 12
  • 14
5

I would recommend opening the terminal and copying in the following:

rm -rf ~/Library/Developer/Xcode/DerivedData

Note: credit to zirinisp for providing the answer that worked for me

Community
  • 1
  • 1
sam_smith
  • 6,023
  • 3
  • 43
  • 60
3

Just delete the Xcode saved state. It worked for me.

BonD
  • 39
  • 3
2

I am using CocoaPod (XCode 8.2), these steps solved my issue:

  1. Go to project folder
  2. Open package contents of .xcworkspace
  3. Delete xcuserdata in package contents
  4. Remove it from Trash (optional)
  5. Go back and open .xcworkspace (XCode will prompt to reopen, but don't do this)
  6. Continue with your project :)
sonnet
  • 567
  • 4
  • 6
2

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

Nitin
  • 497
  • 3
  • 8
1

If you're using CocoaPods, just follow Rob's instruction but on the .xcworkspace file instead and do not delete the .xcworkspacedata file.

  • You're right but they can make clean cocoapods installation if it is necessary. – MGY Oct 04 '17 at 12:31
1

My Solved that worked

  1. Go to project folder
  2. open package contents of .xcodeproject
  3. Delete xcuserdata in package contents
  4. Go back and delete .xcworkspace

/// Please dont delete .pbxproj

Try to open your project and work :)

indrit saveta
  • 127
  • 1
  • 6
1

It's 2021, still having this problem. Reboot doesn't help, OS update doesn't help.

Then I updated everything in the App Store (iMovie, Numbers, Pages, Keynote) and Xcode is now working.

Please don't ask why.

Aitch
  • 1,617
  • 13
  • 24
0

I am using CocoaPods, and followed Rob's Instruction on the .xcworkspace file as indicated above by Allecto. After I "showed Package Contents" on the .xcworkspace file, the only thing I did was to rename the xcuserdata folder to xcuserdataCrashApril2. I was then able to open the project (workspace) with no problems. The only difference is xcode did not save the state of which .swift source code files were previously opened (which is not a big issue for me).

I suppose I can delete the xcuserdataCrashApril2 file, but I am keeping it out there as a reminder of what to do the next time this happens.

AnthonyD
  • 11
  • 1
0

I am using Xcode 8.3

Go to ~/Library/Developer/Xcode

Delete Derived Data folder and it works for me.

May help you.

Ashu
  • 3,373
  • 38
  • 34
0

All the advices from above didn't help me so I added the pod file via pod init & pod install and successfully opened newly created .xcworkspace. Hope it helps somebody

0

I also have this bug with XCode 10.3. In my case i launch app -> it displays alert "Quits unexpectedly" and it doesn't matter what i choose: to reopen or not - it crashes again.

Solution: Reboot Mac :))

Nikita Haiko
  • 371
  • 3
  • 6
0
  1. Delete Project.xcworkspace first.
  2. Open Terminal
  3. Go to application folder
  4. Run command pod install
  5. Delete Derived Data
  6. Open Project.xcworkspace

It works for me.

Yogendra Singh
  • 2,063
  • 25
  • 20