• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Warning: critical Core Data documentation flaw
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Warning: critical Core Data documentation flaw


  • Subject: Re: Warning: critical Core Data documentation flaw
  • From: mmalcolm crawford <email@hidden>
  • Date: Mon, 13 Jun 2005 01:17:40 -0700


On Jun 13, 2005, at 12:53 AM, Larry Gerndt wrote:

In the "Data Modeling Guide", the article "Creating a Managed Object Model Using XCode" has a serious flaw. In its example, It directs you to change the Class of the Employee and Department entities from their default class (NSManagedObject) to class Employee and class Department, respectively. This will make them unusable. The class of a managed object must be a kind of NSManagedObject.

This is simply untrue. Please do not make this sort of assertion without checking your facts first.


The documentation clearly states that the class of a managed object must be NSManagedObject, *or a subclass thereof*.


For example, in "Core Data Basics" <http://developer.apple.com/ documentation/Cocoa/Conceptual/CoreData/Articles/cdBasics.html#// apple_ref/doc/uid/TP40001650-207332-TPXREF151>

"Managed objects must be instances of either NSManagedObject or a subclass of NSManagedObject."


Regarding the tutorial, it is made clear what effect the steps you take have on your class specifications:


<http://developer.apple.com/documentation/Cocoa/Conceptual/ DataModeling/Tasks/modelCreationTask.html#//apple_ref/doc/uid/ TP30001197-171489>

"You have now defined two entities—Employee and Department—***and importantly you have specified that in your application these entities are represented by the Employee and Department classes respectively.***"



This bit me because having read this first, I then went to build and run the example "Introduction to NSPersistentDocument Core Data Tutorial" and while it doesn't say to do that there,

On the contrary:
<http://developer.apple.com/documentation/Cocoa/Conceptual/ NSPersistentDocumentTutorial/03_CustomClass/ chapter_4_section_2.html#//apple_ref/doc/uid/TP40001799-CH219- DontLinkElementID_15>


This section makes it clear that in order to use a custom subclass of NSManagedObject (in this case 'Employee'), you must specify that subclass in the model:

"In the data model (use the entity detail pane, or edit the name directly in the Class column in the entity browser), change the class name for the Employee entity from NSManagedObject to Employee."

...

it also doesn't show the tables where those things are defined, so I didn't know any better and followed my previous directions.

... Contrast the instructions earlier in the tutorial:

<http://developer.apple.com/documentation/Cocoa/Conceptual/ NSPersistentDocumentTutorial/02_CreatingProj/ chapter_3_section_3.html#//apple_ref/doc/uid/TP40001799-CH203- DontLinkElementID_10>

"Items of note and not covered in the tables:
The class for both entities is NSManagedObject; neither entity is abstract."


At this stage there is no custom class. The application can be tested without such.)


As such, when I build and run, the "Add" button resulted in a "failed to create object" exception. This stumped me for about 20 minutes. A visit to Cocoa Builder revealed a lengthy dicussion about how the class of Entities MUST be a kind of NSManagedObeject, so i changed it to that, and now it works.

Did this error occur whilst you were following the tutorial? If so, at what stage, and had you omitted any steps previously?

mmalc

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Warning: critical Core Data documentation flaw
      • From: Larry Gerndt <email@hidden>
References: 
 >Warning: critical Core Data documentation flaw (From: Larry Gerndt <email@hidden>)

  • Prev by Date: Warning: critical Core Data documentation flaw
  • Next by Date: Re: UK Cocoa jobs?
  • Previous by thread: Warning: critical Core Data documentation flaw
  • Next by thread: Re: Warning: critical Core Data documentation flaw
  • Index(es):
    • Date
    • Thread