8

I have a source code of a swift application which developed for iOS using swift 3.

I want to run it inside Xcode however it remains in loading state forever. I have tried solutions provided in question Xcode freezes on startup while loading project however the situation did not change.

The developer of this source code told me that he used Xcode 9.x to develop application so he suggested me to try a 9.x version of Xcode. I guess Xcode should be backward compatible however I want to know does using Xcode 9.x changes the situation or I should look for reason somewhere else?

Kaushik Makwana
  • 1,329
  • 2
  • 14
  • 24
VSB
  • 9,825
  • 16
  • 72
  • 145

7 Answers7

20

Using answer in apple.stackexchange.com did the trick:

Removing the ~/Library/Saved Application State/com.apple.dt.Xcode.savedState/directory might help.

VSB
  • 9,825
  • 16
  • 72
  • 145
13

I tried all the solutions outlined here and none of them worked. However, I managed to fix this issue and here is what worked for me: If you're on an Apple OS and have iCloud sync enabled on your desktop/documents/any folder where you're loading Xcode from, the iCloud sync could be causing this issue.

I installed a fresh copy of my RN project in a directory not synced by iCloud and subsequently the issue was resolved; my build-time was down to a couple of seconds!

Frosty619
  • 1,381
  • 4
  • 23
  • 33
  • this worrked for me as well but is there a Long term solution for this. I would like to keep my projects synced to iCloud – Chetan Kumar Feb 11 '22 at 07:46
  • 2
    oh my god thank you so much!!! Lost many hours to this, all you have to do is add .nosync to the end of your folder name, and it was instantaneous! (like in this article: https://cntechpost.com/2020/03/28/how-to-stop-icloud-from-syncing-a-folder/#:~:text=For%20example%2C%20project%20files%20such,folders%20continuously%20uploaded%20and%20unavailable.&text=At%20this%20point%20you%20just,nosync%22%20to%20the%20file%20name.) – Max Miranda Feb 16 '23 at 02:03
7
rm -rf ~/Library/Developer/xcode

in terminal worked for me, based on this answer

nja
  • 308
  • 5
  • 11
  • 2
    Please note that this will also remove the UserData folder which contains your settings, themes, code snippets, changes to keyboard shortcuts, etc. Maybe something more targeted would be preferable. – Clément Cardonnel Jun 22 '22 at 09:26
  • @Pomme2Poule you have a point, I would like to know a better solution though. XC is just pain sometimes and there's nothing you can do except hard reset – nja Jun 29 '22 at 11:31
4

As of July, 2022, nothing else worked for me but, taking my project outside of the iCloud Drive and putting it into a directory without it. As it is mentioned above, iCloud sync interferes with the XCode running and stalls it.

1

My xcode got hang when I force quit it. After that it was showing only "loading". Here is fix to start xcode from beginning.

cd /  
cd Applications
cd Xcode.app
cd Contents/MacOS
sudo ./Xcode

it will open xcode default window to open a new project.

Kamal Bunkar
  • 1,354
  • 1
  • 16
  • 20
1

I wasted almost 2 hrs and tried everything on stack over flow

SIMPLE SOLUTION

Just turn OFF icloud from your mac os so that it it will not sync the project.

To turn off icloud

  1. Go to setting
  2. Icloud
  3. turn off sync

Thats all enjoy

Kanishka Sahu
  • 119
  • 2
  • 3
0

I tried to delete:

~/Library/Developer/Caches/com.apple.dt.Xcode
~/Library/Developer/Xcode/DerivedData
~/Library/Developer/Saved Application State/com.apple.dt.Xcode.savedState
~/workspace/MyProject.xcodeproj/project.xcworkspace/xcuserdata

and once it helped. But another time it didn't help, so I also tried to reinstall Xcode, which also didn't help.

It turned out that the problem was that I was installing the app via WiFi or Bluetooth. When I connected my device via cable, the Xcode popped up to life and the "loading forever" stopped.

koleS
  • 1,263
  • 6
  • 30
  • 46