Hi.
Make sure the returned preference-string is not nil
Delphi-Quellcode:
function GetPreferenceItem(
const APreference :
string ) :
string;
var
lDefaults : NSUserDefaults;
val : NSString;
begin
lDefaults := TNSUserDefaults.Wrap( TNSUserDefaults.OCClass.standardUserDefaults );
try
val := lDefaults.stringForKey( NSStr(APreference) );
if val <>
nil then
result := UTF8ToString(val.UTF8String);
except on e :
exception do
result := '
';
end;
end;