I have a need to ensure the user-inputed string in a UITextField
is cleared from memory immediately after it has been used. If I set field.text = @""
or nil
and let it go out of scope it should ge gone but I am not sure if it is guaranteed to be released immediately and even if it is, I dont think the OS actually clears the data, it seems likely it is just marked as unused and the data in it is still there until overwritten by something else.
The .text
property of the field is a normal NSString
and I have looked around for ways to get a useable pointer to its contents using the various CFString
/ CString
methods but none of them work. For example CFStringGetCharactersPtr
and CFStringGetCStringPtr
both either return const-pointers which cant be written to, or often NULL
(the docs say it may return null "if the internal storage of the String does not allow this to be returned efficiently") and from my testing it always returns NULL
.
Is there anyway to do this?