Im running Xcode 9.2. My storyboards are completely useless now. Ive
experienced what this article shows and have tried everything the
article suggested.
My issue occurred when I tried to add a single swift file to an existing
objective C project with about 320 files in it already. I removed the
.swift file entirely from the project, then did everything in the article
link above and still nothing fixed it including removing/reloading XCode
several times trying different things.
I filed a bug with apple but haven't received any replies in a week (of course). Apple seems to be slammed with tons of bugs lately they keep
creating.
Now I cannot work on this project's storyboards at all and Im dead in the
water. Really not happy with Apple lately!
Is there anything more that anyone has had success in fixing this issue?
Im completely dead in the water on this application now.
Fixed this by setting the command line tools version to the correct one. Mine was blank in Preferences / Locations
For my case, whenever I open a storyboard from a workspace, this happens. So I got rid of cocoapods and workspace, then just use carthage for thirdparty libraries. Storyboards opens faster and without this error.
Note that the storyboard I am testing is empty.
This turned out to be stupidity on my part. I had a script that was killing certain processes on my Mac over and over and it turns out that was my issue. When I removed it everything worked as normal again.
I've spent the past few months converting a project of mine with about 1500 source code files into Swift. It was incredibly tedious, but I finally did it. It runs well, builds well, but:
When I attempt to archive the project, Xcode fails with the following error:
ditto: can't get real path for source '/Users/USER/Library/Developer/Xcode/DerivedData/
APP-dtsbrzschafjiubelceuxtfwstqf/Build/Intermediates/ArchiveIntermediates/APPCore/
IntermediateBuildFilesPath/APPCore.build/Release/APPCore.build/Objects-normal/
x86_64/APPCore.swiftmodule''
Command /usr/bin/ditto failed with exit code 1
APP being the app and APPCore being the embedded framework.
What I've tried:
cleaning the project (which really has no effect when archiving, since archive always compiles from scratch)
using Xcode 7.2 beta (released a few days ago)
making as many declarations as possible non-public
disabling any Swift optimizations for the release build configuration
building the APPCore framework as release - which actually works (!) - and does (!) create the .swiftmodule file
The last part being the strangest here. This evidently points to the archive doing something slightly different, but I have no idea what.
My question is if anyone has any idea why is this happening and how to debug this. I've spent the last two days trying to figure this out, but no results...
I've googled this error as well, but unfortunately, the answers were fairly limited and suggesting to comment all lines of code and then start slowly uncommenting them until the project builds. Which is OK for a smaller project, but not for a 25KLOC project, mainly when you have absolutely no idea where to start...
I had the same issue and your question actually helped me to solve it (Xcode 8).
In debug mode just got the "ditto: can't get real path for source" without any further information. Switching to release mode showed me that the problem was that the framework wasn't allowed to have a bridging header file. I went to the build settings and removed the bridging header file (don't know why there was one) and it now compiles both in release and debug mode.
Xcode git commit has started crashing.
I recently upgraded my code in preparation for IOS9 XCode7 to work with swift2.0 and did some file reorg using 'git mv' and had it all working, i.e. it committed okay, they while using Xcode7 beta6 it started crashing when I tried to do commits. I have been doing commits from a terminal for a while and when Xcode7 was released I tried again but it still crashes without any explanation. Before I started the conversion I stopped using the source directory and made a separate copy to use during the conversion. In order to get to a working state I have reverted to XCode 6.4 and used the old code but it also crashes. I have even created a new project to no avail.
So, is there something known solution to this problem? And is git "too clever by half' and finds other repositories and causes problems there?
Rebooting the computer fixed this problem. Seems to fix several questions I have been looking at on stackoverflow so I thought I would try it.
This question is a bit old but apparently the problem can still happen in Xcode 8 as I started seeing this problem too; or at least what seems like this problem.
I solved this using the instructions that I found in the article: The Curious Case Of Xcode’s Commit Message.
Basically the article explains how the commit message gets persisted in macOS's pasteboard system and needs to be cleared. That would explain why rebooting fixed this according to #Sojourner9. No need to go to that length though.
Running the following from a terminal sufficed for fixing this problem for me:
printf "from AppKit import NSPasteboard\nNSPasteboard.pasteboardWithName_(\"IDESourceControlCommitMessagePasteboard\").releaseGlobally()" | /usr/bin/python
Note that this is slightly different than what the article says. I replaced the use of echo with printf. printf did the right thing with the \n character in the string. echo meanwhile, had failed for me.
Hope this helps.
In one project I'm using I can't set breakpoints in Swift code, Xcode always crashes when reaching one of them, doesn't matter if it's a "manual" or an exception breakpoint.
In other projects everything works as expected, only for one project Xcode 6.4 (6E35b) always crashes.
I tried cleaning, deleting derived data, resetting simulator, restarting Xcode/Mac - nothing helped at all.
Anyone else experiencing this problem and hopefully knows what helps?
EDIT
Seems only to be the case on one machine (Xcode 6.4, 10.10.5), but not on the other (Xcode 6.4, El Capitan). But as I mentioned in the comments, reinstalling Xcode didn't help, are there some other preferences I could reset/delete?
EDIT2
Here's the Xcode crash log file:
https://dl.dropboxusercontent.com/u/119600/Xcode_2015-08-12-074655_Stefans-iMac.crash
I would try uninstalling and reinstalling Xcode to see if it helps... I've heard of successes with this technique for similar issues.
Just delete the entire Xcode.app from /Applications, and reinstall from the .dmg. If you're not certain of the binaries and have time / bandwidth, consider re-downloading the .dmg.
If that doesn't work, try the following source control tricks (substitute "your favorite revision control" for "git"):
Try purging all objects not in source code control
Another approach: Check out the app again into a fresh repository (this will get even the files that may have been committed but ignored later).
If not under source code control, grab a .gitignore from here and add it to git, then check out into another directory (this will leave everything but source, interface builder, project files and resources/assets behind).
I'd suggest moving the breakpoint code to another location (such as making a function call and breaking either before or inside the function). However, if all Swift code has this problem, that may not work.
Finally, after making an interim commit (to roll back to), try it in Xcode 7 beta. Bit of a hassle because you have to upgrade to Swift 2.0, but if you keep the deployment target the same no iOS target changes are needed.
If this really is a burden and/or it's a small project, you could try creating a new project and migrating the files and storyboard over, but likely this is too much effort.
Either way, since you note it's pretty much all breakpoints in Swift code, file a bug with Apple's bug reporter. They really need to hear about issues such as this, since you don't seem to be alone in having this issue.
EDIT: Where are others seeing this issue?
Maybe we can see commonality -- since this is only reported in Swift projects (so far). A colleague has seen this problem with breakpoints (as well as stepping through code) in Xcode 6.4 on 10.10.4. (I've seen Xcode 6.4 crashes in the past as well).
I see OS version 10.10.5 mentioned as a target where this happens (#swalkner); is this a beta? If OS 10.10.4/5 is the only place we see this, it might be significant. If it's a project/OS interaction, it might be tricky to reproduce / fix, but I'd encourage everyone to submit detailed bug reports to Apple (maybe even link this post).
Some points to note if you're seeing this:
Operating System Version
Hardware
Target: Simulator vs. Hardware; iOS vs WatchKit app.
Target SDK version(s)
Swift only? Or on an Objective-C only project? Mixed?
Only one project, or several?
It's a longshot, but let me know if it's working:
uncheck the "Always show Dissasembly" check
Debug > Debug Workflow > Always Show Disassembly
In older versions of Xcode (<6.1):
Product > Debug Workflow > Show Disassembly When Debugging
I've just spent the past few hours trying to solve exactly the same issue.
I thought at first, it had started due to installing Xcode 7 on the same machine as Xcode 6.4. The problem certainly coincided.
However, due to having version control, I could look and see what files had changed since opening the project with Xcode 7.
The images.xcassets file had changed. Reverting this file back has stopped Xcode from crashing each time it hit a breakpoint.
I'm not sure whether this helps at all, but definitely look at images.xcassets and if needs be, delete it, recreate it and ensure it's setup 100%. It certainly fixed my issue.
I'm currently developing an iOS app using swift and Xcode 6 (Beta 3).
Everything went fine so far but now as my project grows, Xcode suddenly began indexing and it does that again and again, making Xcode nearly unusable.
I have searched the web for similar problems and tried the solutions but none of them did help.
Even disabling the indexing process (defaults write com.apple.dt.Xcode IDEIndexDisable 1) does not stop Xcode to do that.
While indexing, my CPU usage goes up to 300%+, causing the fans to run at highest speed.
In Activity Monitor there are several tasks named "swift" taking up about 1GB memory each.
Killing the processes named 'swift' and then checking the error in xcode will give you the part of the code giving you trouble. There are some bugs in swift that needs to be circumvented.
To kill the process: Applications > Utilities > Activity Monitor. Then find the "swift" process, double click and choose Quit or Force Quit.
Happened to me with Xcode 7.3
Had to clean everything Xcode had cached to solve it.
Solution:
rm -frd ~/Library/Developer/Xcode/DerivedData/*
rm -frd ~/Library/Caches/com.apple.dt.Xcode/*
I had this same issue and it took me FOREVER to solve it. I'm pretty sure I've seen every question on the internet about this issue and I tried all of the solutions. Turns out all I had to do was....
Restart my computer
Solved it: I deleted the most recently added files from the project and the problem disappeared. Then I started to add back the files, one by one until the problem reappeared. So I found the file causing the problem. Then I deleted the most recently added code from that file and again, the problem disappeared.
That way, I found a piece of code which was responsible for that behavior.
I had the same issue in my code. The solution for me was delete all spaces in the array in my code.
Ex.
struct Objects {
let objectA = ["text1",
"text2",
"text3",
"text4"] }
// Noise, CPU 100% and Index forever. The solution is...
struct Objects {
let objectA = ["text1","text2","text3","text4"]}
// Solved making the Array or String with no space.
I had that problem when I was at the swift crunch in krakow a couple weeks ago. We had the code on github, experienced that indexing problem on a macbook, we tried pulling the repo on 2 other macbooks, same result.
It's clearly a bug, I don't know what is causing it, we tried whatever we could think of (clean, clean build folder, manually removing files not in the repo, rebooting, killing processes, etc.), and after a couple hours the only thing left to do was creating a new xcode project from scratch and manually importing the files from the other project.
Never happened again since then, neither on that nor on other projects.
For me, I made a stupid mistake. I write a Class like this:
class A: A {
.......
}
A class inherit itself that causes the freezing. There is no message hint from Xcode. You can just take this as possible reason ~ .
It's Xcode bug. Problem caused with concatenation in one line:
var value = "some text" // it can be String or Array
value = value + value1 + value2 + value3 + value4 + value5 + value6 // etc
This correction fixes this bug:
var value = "some text"
value += value1
value += value2
value += value3
value += value4
value += value5
value += value6
I was creating a dictionary like this
var dic1 = [
"isDestination" : self.isDestination ?? false,
"price" : self.price ?? ""
]
and self.price is of type Int and I was giving its fallback value as an empty string which screwed up the Xcode compilation.
I got this issue and 6 hours later (after trying everithing and build new project again step by step copying resources) I FOUND MY PROBLEM:
class A : A {
...
}
By the fact of copy/paste I had a class that extends itself, and this makes indexing crazy.
It's definitely a Xcode bug and I reported that to Apple. When you have a large dictionary literal or a nested dictionary literal. You have to break your dictionary to smaller parts and add them with append method until they fix the bug.
Xcode 8.2.1 (8C1002)
I had the same problem with one call adding 11 NSLayoutConstraint objects to an array.
The solution was to divide the code into several calls, each adding only 3 objects to the array. Weird.
That was in Xcode 6.4
Too many string concatenations in one line cause troubles. Helped me too.
Originally was pointed by Zhenshan Yu there: Xcode 6 Beta not compiling
I had this issue with XCode 6.3 when creating a C++ project. Before switching over to developing in SubLime, my last ditch effort was to delete the XCode app and reinstall. It was a long process, but my version of XCode is now updated to 7.3 and everything is working as it should.
So if nothing else seems to be working, you could try deleting XCode from your applications folder and then reinstalling. Just be sure you aren't deleting any project files you want to keep.
Mine was about dragging a new file with String extension to the project and not adding it to all required targets.
Hope that helps someone.
Backup your project delete the lastone and restart the xcode simple :-)
I too faced the same issue for Xcode 9.1.
So i looked into Activity Monitor. There was swift process which was above 100%. Double Clicked it and Quit.
Done. Now its working fine.
I went to tools->task and contexts->clear contexts and that seemed to give the computer rest finally!
enter image description here
I got this issue when my Xcode was 9.2 . First I deleted xcworkspace file ,cleaned and built according to the others' answer.But it did not work.
Then I updated Xcode to 9.3 It also did not work. I checked my code and found that the recently written code made Xcode Indexing forever:
TimeInterval(3600*24*(-randomDay))
Then I amended it:
TimeInterval(-3600*24*randomDay)
It worked.
I find that many situations can cause Xcode to work abnormally.So I think the correct solution is that think about what you've done for your project recently
In my case the issue was caused by some aritmetic sums.
I was creating a collectionView with all the different frames programmatically doing it like this:
cell.textView.frame = CGRectMake(8 + 10 + 12, 0, 150 + 6 + 6 + 4, 50)
I just changed it to:
cell.textView.frame = CGRectMake(30, 0, 166, 50)
It helps me figure out the margins and paddings more easily, but just puting the result of the sum changed the build speed from 5 - 7 minutes to 20 seconds or so.
Yet one possible thing, that may cause such behavior:
For debugging purpose I changed system time, set up in one week ago - and I've got infinite indexing. As soon, as I set time back - indexing has stopped.
in my case i had the emulator open with an app builded with previous files. Just close de emulator
I've tried all the things listed, indexing is keep freezing.
This helped me:
If your indexing is freeze, and you have one or more swift process eating 99% of your cpu - just kill this swift task(s), wait a bit, and progress should move.
It can repeats, until it reaches finish, in my case I killed the process 7 times, but at the end, indexing was completed!
For me it was circular inheritance causing the issue:
class CustomButton: CustomButton {
...
}
And various other recent find/replace errors in the code. Xcode wasn't highlighting them as errors and just kept indexing.
I recognized today, that running Apples Playgrounds application alongside Xcode I have that very same symptoms. and maybe that was the root cause in earlier situations. So in my case, closing Playgrounds did the trick.
My particular problem was a fairly long literal dictionary containing much data.
My solution was to understand that Xcode indexing wasn't "stuck", but just taking a long time.
So I only had to wait more time than I expected.
Non of the answers helped in my case. I tried multiple things like:
Device and Simulators - Wifi connected device
Disconnect all devices which can be connected with wirelessly.
Removing Xcode's cache, derived data:
rm -frd ~/Library/Developer/Xcode/DerivedData/*
rm -frd ~/Library/Caches/com.apple.dt.Xcode/*
Deleting defaults for Xcode
defaults delete com.apple.dt.Xcode
Solution
What helped in my case was to rename project folder. Once I did that everything started working again.
In my case, I tried all the suggestions I found on the internet but nothing worked.
The solution that worked for me was to run another project on xcode that could be indexed, and once indexing was done I closed xcode and opened it on the first project that had indexing issues, and it works.
No idea why, but it works :)
This is a workaround I posted on another stackoverflow thread related to Xcode indexing problem. This question looks to be more swift related but my workaround can probably be useful here too. So here it is. My project is very big (merging objective c, c++, swift, and java files with j2obj) and none of the answers here solved the indexing problem. The idea is to limit the CPU usage of the Xcode indexing process with an external tool like cputhrottle.
So first you need to install cputhrottle in terminal
brew install cputhrottle
Then limit the Xcode indexing process like this (20 = 20%)
sudo cputhrottle $(pgrep -f com.apple.dt.SKAgent) 20
I've exposed my "solution" here with more details : How to prevent Xcode using 100% of CPU when indexing big projects