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

# NSShouldRetainWithZone

Indicates whether an object should be retained.

```
extern BOOL NSShouldRetainWithZone(id anObject, NSZone *requestedZone);
```

## Parameters

`anObject`

An object.

`requestedZone`

A memory zone.

## Return Value

Returns <doc://com.apple.documentation/documentation/Swift/true> if `requestedZone` is `NULL`, the default zone, or the zone in which `anObject` was allocated; otherwise <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

This function is typically called from inside an `NSObject`’s <doc://com.apple.documentation/documentation/ObjectiveC/NSObject-swift.class/copyWithZone:>, when deciding whether to retain `anObject` as opposed to making a copy of it.

### Special Considerations

This function is deprecated and unavailable for use with ARC.

---

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)