清除ios的缓存

,你是否在使用高德地图或百度地图时内存持续上涨而烦恼啊?教你一招搞定它,把缓存清理下就爽多了。当然你内存泄漏了,神也救不了你。

在AppDelegate.m或AppDelegate.mm增加这个代码

- (void)applicationDidReceiveMemoryWarning:(UIApplication*)application
{
    NSLog(@"清除所有缓存");
    [[NSURLCache sharedURLCache] removeAllCachedResponses];
}

iphone4手机使用3D地图可能出现内存不足,内存不足时的例子日志如下:
2015/09/06 16:17:56:009 AppDelegate.m:-[AppDelegate applicationDidReceiveMemoryWarning:]:438 Debug:清除所有缓存
2015/09/06 16:18:14:389 MoneyAccountViewController.m:-[MoneyAccountViewController showClass]:138 Debug:函数
2015/09/06 16:18:14:399 MoneyAccountViewController.m:-[MoneyAccountViewController tableView:numberOfRowsInSection:]:88 Debug:函数
2015/09/06 16:18:24:084 MoneyAccountViewController.m:-[MoneyAccountViewController showClass]:138 Debug:函数
2015/09/06 16:18:24:085 MoneyAccountViewController.m:-[MoneyAccountViewController tableView:numberOfRowsInSection:]:88 Debug:函数
2015/09/06 16:18:34:800 AppDelegate.m:-[AppDelegate applicationDidReceiveMemoryWarning:]:438 Debug:清除所有缓存
2015/09/06 16:19:04:968 AppDelegate.m:-[AppDelegate applicationDidReceiveMemoryWarning:]:438 Debug:清除所有缓存
2015/09/06 16:19:20:530 AppDelegate.m:-[AppDelegate applicationDidReceiveMemoryWarning:]:438 Debug:清除所有缓存
2015/09/06 16:19:32:599 AppDelegate.m:-[AppDelegate applicationDidReceiveMemoryWarning:]:438 Debug:清除所有缓存

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值