<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/PersonNameComponentsFormatter/getObjectValue(_:for:errorDescription:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPersonNameComponentsFormatter(im)getObjectValue:forString:errorDescription:"
  },
  "title" : "getObjectValue(_:for:errorDescription:)"
}
-->

# getObjectValue(_:for:errorDescription:)

Returns by reference a person name components object after creating it from a given string.

```
func getObjectValue(_ obj: AutoreleasingUnsafeMutablePointer<AnyObject?>?, for string: String, errorDescription error: AutoreleasingUnsafeMutablePointer<NSString?>?) -> Bool
```

## Parameters

`obj`

On return, contains an instance of [`NSPersonNameComponents`](/documentation/Foundation/NSPersonNameComponents), or `nil` if conversion failed.

`string`

A string that is parsed to create a person name components object.

`error`

If an error occurs, upon return contains an [`NSError`](/documentation/Foundation/NSError) object in the [`NSCocoaErrorDomain`](/documentation/Foundation/NSCocoaErrorDomain) with code [`NSFormattingError`](/documentation/Foundation/NSFormattingError-swift.var) that explains why the conversion failed. If you pass in `nil` for error, you are indicating that you are not interested in error information.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if conversion succeeded; otherwise <doc://com.apple.documentation/documentation/Swift/false>.

---

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)