gpt4 book ai didi

iphone - 编程内存警告 ios

转载 作者:可可西里 更新时间:2023-11-01 06:10:50 25 4
gpt4 key购买 nike

我想在低内存条件下测试我的应用程序。以前我的方法是运行

[NSTimer scheduledTimerWithTimeInterval:2.0 target:[UIApplication sharedApplication] selector:@selector(_performMemoryWarning) userInfo:nil repeats:YES];

但它不再起作用了。我所说的工作是指未调用 didReceiveMemoryWarning。我也试过:

 [[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationDidReceiveMemoryWarningNotification object: [UIApplication sharedApplication]]; 
[[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationDidReceiveMemoryWarningNotification object: nil];
[[UIApplication sharedApplication] _performMemoryWarning];

但以上似乎都不起作用。

任何想法将不胜感激

最佳答案

看这篇文章 Is there a way to send Memory Warning to iPhone device manually?

以编程方式发送:CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), (CFStringRef)@"UISimulatedMemoryWarningNotification", NULL, NULL, true);

在模拟器中:

硬件 -> 模拟内存警告

关于iphone - 编程内存警告 ios,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14474635/

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