gpt4 book ai didi

ios - 如何在我的应用程序中获取 "Storage almost is full"通知

转载 作者:行者123 更新时间:2023-11-28 19:01:04 24 4
gpt4 key购买 nike

如何在我的应用程序中获取“存储空间几乎已满”通知,并且我可以暂停我的下载线程。

我尝试了 didReceiveMemoryWarning(AppDelegate),但失败了。

谢谢

最佳答案

你在这里混淆了内存和存储。

它们是两个不同的东西。

内存是 RAM,存储是“磁盘空间”。

所以 didReceiveMemoryWarning 与“Storage almost full”无关 –

您可以使用

检查可用磁盘空间
+ (NSString *)freeDiskSpace {
long long freeSpace = [[[[NSFileManager defaultManager] attributesOfFileSystemForPath:NSHomeDirectory() error:nil] objectForKey:NSFileSystemFreeSize] longLongValue];
return [self memoryFormatter:freeSpace];
}

但是我不确定警告何时触发

关于ios - 如何在我的应用程序中获取 "Storage almost is full"通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25598137/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com