Difference between revisions of "CFStringRef"

From Xojo Documentation

 
Line 11: Line 11:
 
=== Memory Management ===
 
=== Memory Management ===
  
The Xojo framework handles memory management of CFStringRefs smartly.
+
The Xojo framework handles memory management of CFStringRefs smartly. Based on rules explained under [http://developer.apple.com/library/ios/#DOCUMENTATION/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html Apple's Create Rule], a call to a declared function will either retain (CFRetain) the retrieved value or not. Once the CFStringRef 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 CFStringRef objects you retrieve using declares.
Based on rules explained under Apple's Create Rule, a call to a declared function will either retain (CFRetain) the retrieved value or not. Once the CFStringRef 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 CFStringRef objects you retrieve using declares.
 
 
==See Also==
 
==See Also==
 
[[Declare]] statements; [[String]] data type
 
[[Declare]] statements; [[String]] data type
 
  
 
[[Category:Language_Data_Types-Uncommon]]
 
[[Category:Language_Data_Types-Uncommon]]

Latest revision as of 15:58, 7 June 2018

Data Type


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

Notes

CFStringRef implicitly converts to String or Text when assigned to String or Text variables.

Memory Management

The Xojo framework handles memory management of CFStringRefs smartly. Based on rules explained under Apple's Create Rule, a call to a declared function will either retain (CFRetain) the retrieved value or not. Once the CFStringRef 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 CFStringRef objects you retrieve using declares.

See Also

Declare statements; String data type