Xcode 6.1: no such 'cocoa' module suddenly in all OSX Swift projects

I have been using Xcode 6.1 without problems for several days, but all of a sudden I get an error that doesn't have such a 'Cocoa' module in all of my Swift files. This is an OSX project, not iOS, and the problem occurs in all projects, including new ones.

I checked and corrected the rights to the disk, checked the disk for errors and reset Xcode to the default settings.

+6
source share
3 answers

Uninstalling and reinstalling Xcode solved the problem. Thanks for the radks for the suggestion.

+1
source

I had this problem today in the Swift test benchmark class. I tried both suggested answers, but this did not solve the problem. This turned out to be a user error - I accidentally created an OS X test class in an iOS application.

To say that instead of import Cocoa at the top of my test file file, I had to have import UIKit .

It was believed that it was worth leaving this as an answer to save people by uninstalling and reinstalling Xcode unnecessarily.

+20
source

I ran into the same problem and reinstalled Xcode, the problem is still there.

Finally, I found that my Xcode SourceKitService logs failed and found an answer on Twitter

open a terminal and execute:

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

It works for me!

or you can reset to set the default Xcode on the command line

 defaults delete com.apple.dt.Xcode 
+7
source

Source: https://habr.com/ru/post/977426/


All Articles