<!--
{
  "availability" : [
    "iOS: 2.0.0 - 6.0.0",
    "iPadOS: 2.0.0 - 6.0.0",
    "macCatalyst: 13.1.0 - 13.1.0",
    "macOS: 10.0.0 - 10.8.0",
    "tvOS: 9.0.0 - 9.0.0",
    "visionOS: 1.0.0 - 1.0.0",
    "watchOS: 2.0.0 - 2.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSCopyObject",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@F@NSCopyObject"
  },
  "title" : "NSCopyObject"
}
-->

# NSCopyObject

Creates an exact copy of an object.

```
extern idNSCopyObject(id object, NSUInteger extraBytes, NSZone *zone);
```

## Parameters

`object`

The object to copy.

`extraBytes`

The number of extra bytes required for indexed instance variables (this value is typically `0`).

`zone`

The zone in which to create the new instance (pass `NULL` to specify the default zone).

## Return Value

A new object that’s an exact copy of `anObject`, or `nil` if `object` is `nil` or if `object` could not be copied.

## Discussion

This function is deprecated and unavailable for use with ARC. To create a copy of an object, use the <doc://com.apple.documentation/documentation/ObjectiveC/NSObject-swift.class/copyWithZone:> method instead.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)