Instance Method

replacementObjectForPortCoder:

Overridden by subclasses to substitute another object or a copy for itself during distribution encoding.

Declaration

- (id)replacementObjectForPortCoder:(NSPortCoder *)coder;

Parameters

aCoder

The port coder encoding the receiver.

Return Value

The object encode instead of the receiver (if different).

Discussion

This method is invoked by NSPortCoder. NSObject’s implementation returns an NSDistantObject object for the object returned by replacementObjectForCoder:, enabling all objects to be distributed by proxy as the default. However, if replacementObjectForCoder: returns nil, NSObject’s implementation will also return nil.

Subclasses that want to be passed by copy instead of by reference must override this method and return self. The following example shows how to support object replacement both by copy and by reference:

- (id)replacementObjectForPortCoder:(NSPortCoder *)encoder {
    return [encoder isByref] ? [super replacementObjectForPortCoder:encoder] : self;
}

See Also

Deprecated Methods

- accessibilityAttributeNames

Returns an array of attribute names supported by the receiver.

Deprecated
- accessibilityAttributeValue:

Returns the value of the specified attribute in the receiver.

Deprecated
- accessibilityAttributeValue:forParameter:

Returns the value of the receiver's parameterized attribute corresponding to the specified attribute name and parameter.

Deprecated
- accessibilityActionDescription:

Returns a localized description of the specified action.

Deprecated
- accessibilityActionNames

Returns an array of action names supported by the accessibility element.

Deprecated
- accessibilityArrayAttributeCount:

Returns the count of the specified accessibility array attribute.

- accessibilityArrayAttributeValues:index:maxCount:

Returns a subarray of values of an accessibility array attribute.

- accessibilityIndexOfChild:

Returns the index of the specified accessibility child in the parent.

- accessibilityIsAttributeSettable:

Returns a Boolean value that indicates whether the value for the specified attribute in the receiver can be set.

Deprecated
- accessibilityIsIgnored

Returns a Boolean value indicating whether the receiver should be ignored in the parent-child accessibility hierarchy.

Deprecated
- accessibilityParameterizedAttributeNames

Returns a list of parameterized attribute names supported by the receiver.

Deprecated
- accessibilityPerformAction:

Performs the action associated with the specified action.

Deprecated
- accessibilitySetOverrideValue:forAttribute:

Overrides the specified attribute in the receiver or adds it if it does not exist, and sets its value to the specified value.

Deprecated
- accessibilitySetValue:forAttribute:

Sets the value of the specified attribute in the receiver to the specified value.

Deprecated
- fileManager:shouldProceedAfterError:

An NSFileManager object sends this message to its handler for each error it encounters when copying, moving, removing, or linking files or directories.

Deprecated
- fileManager:willProcessPath:

An NSFileManager object sends this message to a handler immediately before attempting to move, copy, rename, or delete, or before attempting to link to a given path.

Deprecated
- finalize

The garbage collector invokes this method on the receiver before disposing of the memory it uses.

Deprecated
- fontManager:willIncludeFont:

Requests permission from the Font panel delegate to display the given font name in the Font panel.

Deprecated
- namesOfPromisedFilesDroppedAtDestination:

Returns the names of the files that the receiver promises to create at a specified location.

Deprecated
- storedValueForKey:

Returns the property identified by a given key.

Deprecated
- takeStoredValue:forKey:

Sets the value of the property identified by a given key.

Deprecated
- takeValue:forKey:

Sets the value for the property identified by key to value.

Deprecated
- takeValue:forKeyPath:

Sets the value for the property identified by keyPath to value.

Deprecated
- takeValuesFromDictionary:

Sets properties of the receiver with values from a given dictionary, using its keys to identify the properties

Deprecated
- unableToSetNilForKey:

Invoked if key is represented by a scalar attribute.

Deprecated
- valuesForKeys:

Returns a dictionary containing as keys the property names in keys, with corresponding values being the corresponding property values.

Deprecated
- workflowController:didError:

Invoked when the receiver's workflow encounters an error.

Deprecated
- workflowController:didRunAction:

Invoked when an action in the receiver's workflow is finished running.

Deprecated
- workflowController:willRunAction:

Invoked when an action in the receiver's workflow is about to run.

Deprecated
- workflowControllerDidRun:

Tells the delegate that the workflow controller object finished running.

Deprecated
- workflowControllerDidStop:

Tells the delegate that the workflow controller object has stopped.

Deprecated
- workflowControllerWillRun:

Tells the delegate that the workflow controller object is about to run.

Deprecated
- workflowControllerWillStop:

Tells the delegate that the workflow controller object is about to stop.

Deprecated