我正在寻找一些工具/app/tweak,它可以在iPhone上生成内存不足警告(越狱)。或者,作为另一种变体——模拟高内存使用率的调整。
我需要它来测试我的应用程序在内存不足警告时的行为。
- 您可以在模拟器上通过"模拟内存警告"菜单项(从"Hardware
-
在您的设备上,您可以调用专用方法
_performMemoryWarning
#if DEBUG [[UIApplication sharedApplication] performSelector:@selector(_performMemoryWarning)]; #endif
-
另一种解决方案是手动发送通知:
CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), (CFStringRef)@"UISimulatedMemoryWarningNotification", NULL, NULL, true);
当你在模拟器上运行应用程序时,你可以通过:
硬件(在顶部菜单上)->模拟内存警告
对于真正的设备,你可以用一种私人方法:
[[UIApplication sharedApplication] performSelector:@selector(_performMemoryWarning)];