在iOS 11下,下面给出的答案不再提供准确的结果。可以传递新的卷容量键,以URL.resourceValues(forKeys:)
提供与设备设置中可用值匹配的值。
static let volumeAvailableCapacityKey: URLResourceKey
卷的可用容量的键(以字节为单位)(只读)。
static let volumeAvailableCapacityForImportantUsageKey: URLResourceKey
卷的可用容量(以字节为单位)的键,用于存储重要资源(只读)。
static let volumeAvailableCapacityForOpportunisticUsageKey: URLResourceKey
卷的可用容量(以字节为单位)的键,用于存储非必需资源(只读)。
static let volumeTotalCapacityKey: URLResourceKey
卷总容量的键(以字节为单位)(只读)。