-1

Whenever I try to Create NSManagedObject Subclass for my Core Data Entity. However as soon as I do this I get this error:

Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1

As you can see it talks about a swiftc file within Xcode itself. So I found this file and deleted it an tried to replace it but I still get the same error.

Here's what I've tried:

  • Deleting Xcode & Reinstalling
  • Removing the Command Line Tools & Reinstalling Xcode
  • Removing the File and Trying to recreate it

Is it because the file there has no code? What should I do?

mkehoe
  • 11
  • 4
  • 3
    `swiftc` is the swift compiler. That error is saying that the swift compiler encountered and error and failed returning an exit code of 1. Go to the Report Navigator (cmd 9) and choose the build to see the whole error. – Craig Siemens Jan 22 '18 at 21:33
  • Without seeing the *full* error, it's hard to help. But deleting Xcode & reinstalling? That may be needed *now* because you've potentially deleted core Xcode compiler files. Try this: (1) Create an empty project, throw up a label or two, and build it and run it. If it works, you don't need to delete/reinstall anything. (2) Slowly recreate your issue - and document the steps you do. By "slowly" I mean one thing at a time followed by building and running. By "document" I mean log every step. (3) Once you run into the error, edit *this* question with *both* the steps *and* the full error. –  Jan 23 '18 at 01:35
  • @dfd That's what I have done. I created a new project, add all my code. NO Issues. Created a Core Data Model. No Issues. Editor -> Create NSManagedObject Subclass. Then the problem arrises – mkehoe Jan 23 '18 at 17:14
  • I *may* have gotten the same error. (1) Created a new project. (2) Added a new Data Model file *in* the project. (3) Added an entity and gave it an attribute of type Int16. (4) Created a `NSManagedObject` subclass, which created two files *outside* of the project folder. –  Jan 23 '18 at 17:30
  • I have the full error now from what @CleverError said : https://imgur.com/a/jvhAY – mkehoe Jan 23 '18 at 17:40
  • I've tried deleting the file in the the derivied data but it recreates itself. @dfd – mkehoe Jan 23 '18 at 17:41
  • I've solved it. I needed to go into my Core Data Model and change the class Module to Current Project Model and CMD+swift+option+k – mkehoe Jan 23 '18 at 18:02
  • Whichever @dfd or – mkehoe Jan 23 '18 at 18:04
  • @CleverError wants to add that as the answer please do – mkehoe Jan 23 '18 at 18:04
  • I agree. It's very acceptable to answer your own question. I would also suggest adding the full error to the question. This will help others with the same issue. I was working on a solution but it looks like you already found it. Expect an up vote from me. Everything I was seeing looks like the solution may be a bit different in Xcode 9 from Xcode 8? (Not the issue, just navigating Xcode to solve it?) BTW, I didn't down vote the question - that was someone else. –  Jan 23 '18 at 18:11
  • I checked the link, and *yes* that's the error I was getting. If you want to include it in your question, copy/paste it into your question, block quote it, and (at least I would) remove the file paths - just indicate that your model was automatically generating the files already. I only found a good solution is you were using Xcode 8.https://stackoverflow.com/questions/39657231/xcode-8-generates-broken-nsmanagedobject-subclasses-for-ios-10#39711559 –  Jan 23 '18 at 18:16

1 Answers1

1

swiftc is the swift compiler. That error is saying that the swift compiler encountered and error and failed returning an exit code of 1.

Go to the Report Navigator (cmd 9) and choose the build to see the whole error.

Craig Siemens
  • 12,942
  • 1
  • 34
  • 51