iPhone: available disk space

前端 未结 3 1529
清酒与你
清酒与你 2021-01-14 14:30

I am creating an audio-recording application and I need to know how much disk space is available (not ram).

How can I retrieve it?

Thanks.

3条回答
  •  旧时难觅i
    2021-01-14 14:38

    Best solution for me is to use the NSFileManager method:

    - (NSDictionary *)attributesOfFileSystemForPath:(NSString *)path error:(NSError **)error
    

    on the directory where you want to save your data. This is a wrapper around the statfs system call, as is mentioned in the docs. But if you're already using NSFileManager, this would be the way to go.

提交回复
热议问题