Deprecated NSKeyValueCoding Methods
A method identified as deprecated has been superseded and may become unsupported in the future.
Deprecated in OS X v10.3
handleQueryWithUnboundKey:
Invoked by valueForKey: when it finds no property corresponding to key. (Deprecated in OS X v10.3. Use valueForUndefinedKey: instead.)
Availability
- Available in OS X v10.0 and later.
- Deprecated in OS X v10.3.
Declared In
NSKeyValueCoding.hhandleTakeValue:forUnboundKey:
Invoked by takeValue:forKey: when it finds no property binding for key. (Deprecated in OS X v10.3. Use setValue:forUndefinedKey: instead.)
Availability
- Available in OS X v10.0 and later.
- Deprecated in OS X v10.3.
Declared In
NSKeyValueCoding.htakeValue:forKey:
Sets the value for the property identified by key to value. (Deprecated in OS X v10.3. Use setValue:forKey: instead.)
Availability
- Available in OS X v10.0 and later.
- Deprecated in OS X v10.3.
Declared In
NSKeyValueCoding.htakeValue:forKeyPath:
Sets the value for the property identified by keyPath to value. (Deprecated in OS X v10.3. Use setValue:forKeyPath: instead.)
Availability
- Available in OS X v10.0 and later.
- Deprecated in OS X v10.3.
Declared In
NSKeyValueCoding.htakeValuesFromDictionary:
Sets properties of the receiver with values from a given dictionary, using its keys to identify the properties (Deprecated in OS X v10.3. Use setValuesForKeysWithDictionary: instead.)
Availability
- Available in OS X v10.0 and later.
- Deprecated in OS X v10.3.
Declared In
NSKeyValueCoding.hunableToSetNilForKey:
Invoked if key is represented by a scalar attribute. (Deprecated in OS X v10.3. Use setNilValueForKey: instead.)
Availability
- Available in OS X v10.0 and later.
- Deprecated in OS X v10.3.
Declared In
NSKeyValueCoding.hvaluesForKeys:
Returns a dictionary containing as keys the property names in keys, with corresponding values being the corresponding property values. (Deprecated in OS X v10.3. Use dictionaryWithValuesForKeys: instead.)
Availability
- Available in OS X v10.0 and later.
- Deprecated in OS X v10.3.
Declared In
NSKeyValueCoding.hDeprecated in OS X v10.4
useStoredAccessor
Returns YES if the stored value methods storedValueForKey: and takeStoredValue:forKey: should use private accessor methods in preference to public accessors. (Deprecated in OS X v10.4. This method has no direct replacement, although see accessInstanceVariablesDirectly.)
Discussion
Returning NO causes the stored value methods to use the same accessor method or instance variable search order as the corresponding basic key-value coding methods (valueForKey: and takeValue:forKey:). The default implementation returns YES.
Applications should use the valueForKey: and setValue:forKey: methods instead of storedValueForKey: and takeStoredValue:forKey:.
Availability
- Available in OS X v10.0 and later.
- Deprecated in OS X v10.4.
Declared In
NSKeyValueCoding.hstoredValueForKey:
Returns the property identified by a given key. (Deprecated in OS X v10.4. If you are using the NSManagedObject class, use primitiveValueForKey: instead.)
Discussion
This method is used when the value is retrieved for storage in an object store (generally, this storage is ultimately in a database) or for inclusion in a snapshot. The default implementation is similar to the implementation of valueForKey:, but it resolves key with a different method/instance variable search order:
Searches for a private accessor method based on key (a method preceded by an underbar). For example, with a key of “lastName”,
storedValueForKey:looks for a method named_getLastNameor_lastName.If a private accessor is not found, searches for an instance variable based on key and returns its value directly. For example, with a
keyof “lastName”,storedValueForKey:looks for an instance variable named_lastNameorlastName.If neither a private accessor nor an instance variable is found,
storedValueForKey:searches for a public accessor method based on key. For the key “lastName”, this would begetLastNameorlastName.If key is unknown,
storedValueForKey:callshandleTakeValue:forUnboundKey:.
This different search order allows an object to bypass processing that is performed before returning a value through a public API. However, if you always want to use the search order in valueForKey:, you can implement the class method useStoredAccessor to return NO. And as with valueForKey:, you can prevent direct access of an instance variable with the class method accessInstanceVariablesDirectly.
Availability
- Available in OS X v10.0 and later.
- Deprecated in OS X v10.4.
Declared In
NSKeyValueCoding.htakeStoredValue:forKey:
Sets the value of the property identified by a given key. (Deprecated in OS X v10.4. If you are using the NSManagedObject class, use setPrimitiveValue:forKey: instead.)
Discussion
This method is used to initialize the receiver with values from an object store (generally, this storage is ultimately from a database) or to restore a value from a snapshot. The default implementation is similar to the implementation of takeValue:forKey:, but it resolves key with a different method/instance variable search order:
Searches for a private accessor method based on key (a method preceded by an underbar). For example, with a key of “lastName”,
takeStoredValue:forKey:looks for a method named_setLastName:.If a private accessor is not found, searches for an instance variable based on key and sets its value directly. For example, with a key of “lastName”,
takeStoredValue:forKey:looks for an instance variable named_lastNameorlastName.If neither a private accessor nor an instance variable is found,
takeStoredValue:forKey:searches for a public accessor method based on key. For the key “lastName”, this would besetLastName:.If key is unknown,
takeStoredValue:forKey:callshandleTakeValue:forUnboundKey:.
This different search order allows an object to bypass processing that is performed before setting a value through a public API. However, if you always want to use the search order in takeValue:forKey:, you can implement the class method useStoredAccessor to return NO. And as with valueForKey:, you can prevent direct access of an instance variable with the class method accessInstanceVariablesDirectly.
Availability
- Available in OS X v10.0 and later.
- Deprecated in OS X v10.4.
Declared In
NSKeyValueCoding.h© 2011 Apple Inc. All Rights Reserved. (Last updated: 2011-06-06)