Author Topic: Chapter 12 Creating Entity Classes problem  (Read 3999 times)

Sam

  • Newbie
  • *
  • Posts: 9
    • View Profile
Chapter 12 Creating Entity Classes problem
« on: March 25, 2018, 11:47:32 PM »
So since this book was written, creating NSManagedObject subclass has been moved (apparently) to the Editor main menu.

However, when attempting to create this subclass while the xcdatamodel is selected creates Property and Class subfiles that are full of errors.

I've tried to follow the book instructions a few times now, adapting to the new detour of adding the subclass through the Editor menu and I continue to get these errors.  Have tried to build in Xcode 8.3.3 as well as 9.3.  See attached screenshot please.

Kevin kindly sent an updated mmBusinessObject file along with a couple of other files but they don't seem to address this issue.

please advise on fixes - thank you!

angelina

  • Global Moderator
  • *****
  • Posts: 25
    • View Profile
Re: Chapter 12 Creating Entity Classes problem
« Reply #1 on: March 27, 2018, 02:37:09 PM »
Hi Sam,

This book hasn't been updated in a while and there have been some minor changes in Xcode.  One of these changes is how you generate Core Data Entity classes from the Data Model as explained on page 330 (“Generating Entity Classes From the Data Model”).  When you create the entity classes for ShipmentEntity and DeliveryStatusEntity, follow these steps:

1. “Select the iDeliverMobileCD entity data model in the Project Navigator.”

2. Select the DeliveryStatusEntity and in the Data Model inspector, change Codegen to Manual/None.  Do the same thing for ShipmentEntity.

3. With the Data Model still selected and at least one of the Entities selected, go to Editor > Create NSManagedObject Subclass...

4. On the window that appears, make sure iDeliverMobileCD is checked and select Next.

5. Select the entities you would like to manage in the next window so make sure there's a checkmark next to both the ShipmentEntity and the DeliveryStatusEntity and select Next.

6. After verifying the file save location in the next window, select Create.

Note that the ShipmentEntity.swift and DeliveryStatusEntity.swift files as referred to in the book are now named ShipmentEntity+CoreDataClass.swift and DeliveryStatusEntity+CoreDataClass.swift.



Angelina
Oak Leaf Enterprises, Inc.

Sam

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Chapter 12 Creating Entity Classes problem
« Reply #2 on: March 27, 2018, 09:36:08 PM »
Awesome!!!  Thank you Angelina; all errors cleared up!!!

Upwards and onwards!!!

Wmaz

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Chapter 12 Creating Entity Classes problem
« Reply #3 on: March 29, 2018, 07:15:47 AM »
Can we expect an update to the book soon?

angelina

  • Global Moderator
  • *****
  • Posts: 25
    • View Profile
Re: Chapter 12 Creating Entity Classes problem
« Reply #4 on: April 04, 2018, 10:45:10 AM »
We're anticipating updating Book 3 after this year’s WWDC.



Angelina
Oak Leaf Enterprises, Inc.