0

有人可以指出或帮助我使用 Delphi XE4 获取 IPHONE/IPAD 设备总磁盘大小。

我只需要一个起点,我尝试使用:

Device : UIDevice;

但它没有参考。

谢谢你

4

1 回答 1

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;
于 2013-05-06T12:33:31.743 回答