0

can someone points or helps me in getting the IPHONE / IPAD device total disk size using the Delphi XE4 .

i need just a start point , i tried to use the :

Device : UIDevice;

but it has no reference .

thank you

RRUZ
  • 130,998
  • 15
  • 341
  • 467

1 Answers1

1
uses
  iOSapi.Foundation, Macapi.ObjectiveC;

function GetTotalDiskSize(FolderName: string): Int64;
var
  Dict: NSDictionary;
  P: Pointer;
const
  FoundationFwk: string = '/System/Library/Frameworks/Foundation.framework/Foundation';
begin
  Result := 0;
  Dict := TNSFileManager.Wrap(TNSFileManager.OCClass.defaultManager).attributesOfFileSystemForPath(NSStr(FolderName), nil);
  if Dict = nil then
    Exit;
  P := Dict.objectForKey((CocoaNSStringConst(FoundationFwk, 'NSFileSystemSize') as ILocalObject).GetObjectID);
  if Assigned(P) then
    Result := TNSNumber.Wrap(P).unsignedLongLongValue;
end;
Sebastian Z
  • 4,417
  • 1
  • 14
  • 28