Type Method

valueWithNonretainedObject:

Creates a value object containing the specified object.

Declaration

+ (NSValue *)valueWithNonretainedObject:(id)anObject;

Parameters

anObject

The value for the new object.

Return Value

A new value object that contains anObject.

Discussion

This method is equivalent to invoking value:withObjCType: in this manner:

NSValue *theValue = [NSValue value:&anObject withObjCType:@encode(void *)];

This method is useful if you want to add an object to a Collection but don’t want the collection to create a strong reference to it.

See Also

Working with Pointer and Object Values

+ valueWithPointer:

Creates a value object containing the specified pointer.

pointerValue

Returns the value as an untyped pointer.

nonretainedObjectValue

The value as a non-retained pointer to an object.