Xcode 10.2 (and 10.2.1) is crashing the entire machine when converting from Swift 4 to Swift 5
Asked Answered
V

1

8

I have a Mac application project that builds and runs in XCode 10.2.1 using Swift 4. When I try to convert it to Swift 5, the process starts, and then at about step 32 (of about 158), the machine locks up to the point where it either reboots, or I have to force it to shut down. What should I be looking for to stop this from happening?

By “lock up” I mean everything stops. The spinning wheel graphic in XCode that indicates that things are going on stops spinning. The mouse pointer freezes. The keyboard is non-responsive. Any on screen animations stop (eg if the pointer is the Spinning Pizza of Death - that stops spinning) If I leave it long enough, it may reboots - two chimes.

I have tried converting another project, and that converts without any problems. So I am going to assume that there is something specific to the project I have that’s the problem

I have tried this on two machines - my 2012 Mac Mini with 16GB RAM, and a MBP which is a couple of years newer with 8GB RAM. Same problem on both.

I have also tried setting the Swift version from 4.0 to 4.2 in the project. The same thing happens - the machine processes the change and locks up during the process. However, this time before locking up I get the Force Quit dialog window, and a message telling me that all available application memory has been used up, and I should force quit applications. At this point, the machine freezes, so I can’t do that.

I’ve tried a few searches on the subject, but have found nothing that describes my problem.

I have no code to show because I don’t know what code is causing this (if anything - it could be a bug in XCode of course). It could be a setting in the Xcode project file.

Desired results - Xcode converts my project from Swift 4 to Swift 5.

Actual results - Xcode locks up the machine completely. I have to force power down my Mac and reboot.

So the question is - what should I be looking for to get around this issue? Has anyone else had this problem? What can I try to resolve this? The freezing and rebooting is a bit alarming.

Visual answered 18/4, 2019 at 9:7 Comment(7)
Try switching on compile times for files while in Swift 4. It might supply a clue. irace.me/swift-profilingHistoid
Xcode 10.2.1 released today might help. There was mention of a build time fix.Histoid
Thanks, both, I’ll try timing the co pile times. I get the same issue in 10.2.1 (I did mention this version in the original question) as 10.2.Visual
If the conversion to Swift5 could be triggered in terminal perhaps it would yield information on the last command that was used by XCode.Horologist
Good point @Horologist You can also watch the build happen in the Report Navigator in Xcode but it would be slightly hidden under the converter modal.Histoid
Nothing in the compile times jumps out as being something that could be a log jam. The project doesn't take that long to compile in Swift 4, (15-20 seconds, I guess). It certainly doesn’t feel as if it}s getting stuck anywhere in the process. @kamil.S - is this possible? If so, that might help. Right now, that modal window in the converter covers a fair amount of the Xcode Window, and obviously when the system seizes up, it’s not going anywhere. My only other thought is to go back to Xcode 10, see if it will convert to Swift 4.2, and then try converting to 5 in 10.2.1.Visual
Success! I reverted to Xcode 10.0, and installed the appropriate Xcode command line tools (just in case) and converted to Swift version 4.2. Then, I re-installed Xcode 10.2.1 and the appropriate command line tools, and ran the conversion again. It trundled through (I thought when it got to stop 32 in the process that it would hang again), but it completed the task and let me carry on. The project builds with no errors after that. Thanks all for taking time to offer your thoughts.Visual
E
1

What worked for me is to move one view controller from each storyboard file and save the file. For some reason Xcode crashes my computer if I don't do that every time I reopen Xcode. After I saved each storyboard file, I converted the project to Swift 5 with no problems.

Epidermis answered 27/8, 2019 at 13:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.