如何告诉用户您的 iOS 应用程序需要多少内存

发布于 2024-10-04 08:21:53 字数 244 浏览 5 评论 0原文

我正在开发一个 iOS 应用程序,它(与任何其他应用程序一样)需要一定量的可用内存才能正确运行。就我而言 - 至少 4MB,我不能使用少于该值的空间。这是一个相当小的数量,但有几次(至少在我的设备上)我只有 2MB 可用空间,并且程序崩溃了。您认为告诉用户您需要多少内存的最佳方式是什么?我知道获取当前可用内存的代码,但即使我告诉用户(例如用户启动程序时在 UIAlertView 中)他的内存不足,我可以建议他做什么来释放更多内存(除了转动关闭和打开设备)。有什么想法吗?

I'm developing an iOS application which (like any other) requires a certain amount of free memory to run correctly. In my case - at least 4MB, I cannot use any less than that. It's a fairly small amount, but a few times (on my device at least) I got only 2MB free and the program crashed. What do you think is the best way to tell users how much memory you need. I know the code to get the currently available memory, but even if I tell the user (like in a UIAlertView when the user starts the program) that he is running low, what can I suggest him to do to free more memory (except turning off and on the device). Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

别闹i 2024-10-11 08:21:53

在较旧的设备上,您不能真正依赖获得超过 8MB 的空间。 4MB 是一个很好的目标,如果通过分析您确定这就是您所需要的,那么应该没问题。

然而,我认为这里的概念是,如果您收到内存警告,您就不会用这些类型的事情来打扰用户。我自己也会觉得这很烦人。最好限制您的应用程序的活动或限制您正在做的任何内存密集型操作。

On older devices you can't really rely on getting more than 8MB. 4MB is a great target, and if through your profiling you've determined that's all you need, you should be fine.

However, I think the concept here is that if you receive memory warnings you wouldn't bother the user with those types of things. I would find it pretty annoying myself. It would be better to limit your app's activity or throttle back whatever you are doing that is so memory intensive.

三生池水覆流年 2024-10-11 08:21:53

您的应用程序正在哪些类型的 iPhone 设备上进行测试?我想iOS必须做好它的工作,为你释放足够的内存,或者杀死所有后台应用程序,这样它才能有更多的内存

On which kinds of iPhone devices your app is being tested? I suppose that the iOS has to do its job well to free enough memory for you or kill alll background app so it can have more memory

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文