如何找到我的应用 运行 所在设备的总磁盘大小?

How can I find the total disk size of the device my app is running on?

我想知道我的应用 运行 所在设备的总磁盘大小是多少。例如,我想查找它是 iphone6 16gb 还是 32gb。

SystemInfo中,有一个属性systemMemorySize。但是 returns RAM 的数量。我想找到硬盘大小。怎么做?

谢谢。

DriveInfo class 用于在 Windows 或台式计算机上执行类似操作。不确定这是否适用于 iOS,因为它使用 GetDrives() 函数来获取磁盘大小。真正的解决方案是使用 Objective-C.

制作一个原生插件

幸运的是,有一个名为 Simple Disk Utils on the Asset store. You can also get its source code from here 免费 插件。

可用函数:

int CheckAvailableSpace(); 
int CheckBusySpace();
int CheckTotalSpace(); //<--- You need this