DataType

# CFStringRef

<div class="rst-class">

forsearch

</div>

DataType

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

This is an advanced data type for use with macOS and iOS API calls to handle OS strings.

## Notes

<span class="title-ref">CFStringRef</span> implicitly converts to `String</api/data_types/string>` when assigned to a String variable.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Memory management

The Xojo framework handles memory management of CFStringRefs smartly. Based on rules explained under [Apple's Create Rule](http://developer.apple.com/library/ios/#DOCUMENTATION/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html), a call to a declared function will either retain (CFRetain) the retrieved value or not. Once the <span class="title-ref">CFStringRef</span> object goes out of scope (i.e. it's no longer referenced by Xojo code), it will be released by calling CFRelease. That means that you usually do not have to worry about proper Retain/Release calls for <span class="title-ref">CFStringRef</span> objects you retrieve using declares.

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |

<div class="seealso">

`Declare</api/language/declare>` statements; `String</api/data_types/string>` data type

</div>
