4

I recently updated to Xcode 8 and did the auto swift 3 conversion. I then read about the new Core Data auto-generated subclassing. I had defined classes but wanted to switch, so I deleted all my defined classes and then switched all the entity definitions' Codegen drop down to Class Definition and my project won't build. I believe it's because it hasn't generated the classes but I'm not sure. Here's the error I'm getting:

<unknown>:0: error: no such file or directory: '*my file path to the iphonesimulator/Debug-iphonesimulator/LoRezDungeon.build/DerivedSources/CoreDataGenerated/GameDataModel/.UAWeapon+CoreDataProperties.swift'
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1

This is just the last Entity error, All entities in my xcdatamodel file throw the error, the command portion is just displayed once at the end of the error log.

I say I assume it just isn't generating the files because it says there is no such file as the auto-generated classes should be.

How can I force them to generate or how can I fix this? I tried what some other have said and made entity changes, saved. Changed entity name changes and saved. Cleaned and rebuilt. Same thing just keeps happening and I'm stuck. Thanks in advance for the help.

EDIT: I checked the directory it's talking about and there are generated files there so idk why it's not building..

EDIT 2: The classes do exist in the directory but they don't start with a ., any idea why this would be happening or if it's a bug?

EDIT 3: Well, I'm kinda just assuming this is a bug they need to fix, decided to do manual creation again and this is also a thing: XCode 8 generates broken NSManagedObject subclasses for iOS 10

This among other things I'm just going to wait for an update for like a month before I continue my personal development. This is just frustrating.. :(

Community
  • 1
  • 1
tpoppen
  • 41
  • 3
  • Are you still using an Xcode 8 beta? I had this problem once, but not with the released version of Xcode 8. – Tom Harrington Oct 08 '16 at 23:17
  • Good question, I'm not sure. I'll check. Would there potentially be a bug with not being on the newest OS as well? I think I just downloaded the xcode update and not the OS update. – tpoppen Oct 08 '16 at 23:29
  • Looks like I do have the Latest Xcode update and not just the beta. I'm going to try to update my OS and see if anything comes of it.. – tpoppen Oct 08 '16 at 23:36
  • Also reverted to manual creation. This solution worked for me to get rid of the errors: stackoverflow.com/a/39711559/2829102, though using Current Product Module instead of Global namespace. – Rygen Oct 14 '16 at 15:49

3 Answers3

1

Double check the Codegen option is set to 'Class Definition', sometimes it doesn't save when you change it and will go back to 'Manual/None'. This is a real pain.

Clean your build folder.

Change your #import statements to "MyClass+CoreDataClass.swift"

trapper
  • 11,716
  • 7
  • 38
  • 82
1

The "Module" combo box for that entity is set to "Current Product Module," delete the contents of the combo box so it reverts to the default of "Global namespace."

Chris Hanson
  • 54,380
  • 8
  • 73
  • 102
0

I haven't tried auto Swift 3 conversion, but normally you can generate these kind of files automatically. Go on you model, click Editor in the menu bar and choose "Create NSManages Subclass". It should generate every class again, maybe it helps.

bjrne
  • 355
  • 5
  • 14
  • That's the manual way of adding subclasses but from what I understand it's supposed to automatically create them without them showing up in your xcode project view. Before trying this I had done it that way and it worked fine but tried the new thing mention in the new documentation. Appreciate the effort thought. – tpoppen Oct 08 '16 at 23:20