Instance Method


Returns the value for the specified property from the managed object’s private internal storage .


- (id)primitiveValueForKey:(NSString *)key;



The name of one of the receiver's properties.

Return Value

The value of the property specified by key. Returns nil if no value has been set.


This method does not invoke the access notification methods (willAccessValueForKey: and didAccessValueForKey:). This method is used primarily by subclasses that implement custom accessor methods that need direct access to the receiver’s private storage.

Special Considerations

Subclasses should not override this method.

The following points also apply:

  • Primitive accessor methods are only supported on modeled properties. If you invoke a primitive accessor on an unmodeled property, it will instead operate upon a random modeled property. (The debug libraries and frameworks (available from Apple Developer Website) have assertions to test for passing unmodeled keys to these methods.)

  • You are strongly encouraged to use the dynamically-generated accessors rather than using this method directly (for example, primitiveName: instead of primitiveValueForKey:@"name"). The dynamic accessors are much more efficient, and allow for compile-time checking.

See Also

Supporting Key-Value Coding

- valueForKey:

Returns the value for the property specified by key.

- setValue:forKey:

Sets the specified property of the managed object to the specified value.

- mutableSetValueForKey:

Returns a mutable set that provides read-write access to the unordered to-many relationship specified by a given key.

- setPrimitiveValue:forKey:

Sets the value of a given property in the managed object's private internal storage.

- objectIDsForRelationshipNamed:

Returns the object IDs for all of the managed objects that are in the named relationship.