---
title: "getObjectValue(_:for:errorDescription:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/energyformatter/getobjectvalue(_:for:errordescription:)"
---

# getObjectValue(_:for:errorDescription:)

This method is not supported for the NSEnergyFormatter class.

## Declaration

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

## Parameters

- `obj`: An output parameter. If overridden, this parameter should contain the object created from the provided string.
- `string`: A string representation of the object.
- `error`: An output parameter. If overridden, this parameter should contain a description of any errors that occur. If you do not want to receive error messages, set this parameter to NULL.

## Return Value

Return Value true if the conversion from string was successful; otherwise, false.

## Discussion

Discussion You can override this method in a subclass. For more information, see Formatter.

## See Also

### Related Documentation

- [getObjectValue(_:for:errorDescription:)](foundation/formatter/getobjectvalue(_:for:errordescription:).md)

### Formatting Energy Strings

- [isForFoodEnergyUse](foundation/energyformatter/isforfoodenergyuse.md)
- [numberFormatter](foundation/energyformatter/numberformatter.md)
- [string(fromJoules:)](foundation/energyformatter/string(fromjoules:).md)
- [string(fromValue:unit:)](foundation/energyformatter/string(fromvalue:unit:).md)
- [unitString(fromJoules:usedUnit:)](foundation/energyformatter/unitstring(fromjoules:usedunit:).md)
- [unitString(fromValue:unit:)](foundation/energyformatter/unitstring(fromvalue:unit:).md)
- [unitStyle](foundation/energyformatter/unitstyle.md)
