iOS 后台退出app时不执行applicationWillTerminate的临时解决方法
- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
//实现一个可以后台运行几分钟的权限, 当用户在后台强制退出程序时就会走applicationWillTerminate 了.
[[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:nil];
}
- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
NSString * AddressBookIndex = @"AddressBook_index";
NSString * AddressBookDataArray = @"AddressBook_dataArray";
NSString * AddressBookPhonePerson = @"AddressBook_Person";
[[NSUserDefaults standardUserDefaults] removeObjectForKey:AddressBookIndex];
[[NSUserDefaults standardUserDefaults] removeObjectForKey:AddressBookDataArray];
[[NSUserDefaults standardUserDefaults] removeObjectForKey:AddressBookPhonePerson];
}
iOS 后台退出app时不执行applicationWillTerminate的临时解决方法的更多相关文章
- iOS UITableViewCell点击时子视图背景透明的解决方法
在做iOS项目的开发中,UITableView控件的应用十分广泛.在进行自定义UITableViewCell时,经常遇到这样的问题:在UITableViewCell上面添加了一个有背景颜色的子视图,当 ...
- 安装CentOS、Linux系统时,GPT分区不能引导的解决方法
安装系统:CentOS 5.9_64bit时,分区后, 提示如下错误. 解决方法: 1.按ctrl+alt+F2 进入命令行 2.先查看分区 sh #fdisk -l 以下假设分区是/dev/s ...
- universal image loader在listview/gridview中滚动时重复加载图片的问题及解决方法
在listview/gridview中使用UIL来display每个item的图片,当图片数量较多需要滑动滚动时会出现卡顿,而且加载过的图片再次上翻后依然会重复加载(显示设置好的加载中图片) 最近在使 ...
- 史上最全的CSS hack方式一览 jQuery 图片轮播的代码分离 JQuery中的动画 C#中Trim()、TrimStart()、TrimEnd()的用法 marquee 标签的使用详情 js鼠标事件 js添加遮罩层 页面上通过地址栏传值时出现乱码的两种解决方法 ref和out的区别在c#中 总结
史上最全的CSS hack方式一览 2013年09月28日 15:57:08 阅读数:175473 做前端多年,虽然不是经常需要hack,但是我们经常会遇到各浏览器表现不一致的情况.基于此,某些情况我 ...
- flask使用第三方云通讯平台时,出现{'172001':'网络错误'}解决方法
问题描述:flask使用第三方云通讯平台时,出现{'172001':'网络错误'} 解决方法: 在sms.py文件中添加如下代码 import ssl # 取消证书验证ssl._create_defa ...
- 百度编辑器ueditor 异步加载时,初始化没办法赋值bug解决方法
百度编辑器ueditor 异步加载时,初始化没办法赋值bug解决方法 金刚 前端 ueditor 初始化 因项目中使用了百度编辑器——ueditor.整体来说性能还不错. 发现问题 我在做一个编辑页面 ...
- Easyui中使用jquery或js动态添加元素时出现的样式失效的解决方法
Easyui中使用jquery或js动态添加元素时出现的样式失效的解决方法 2014-03-27 11:44:46| 分类: Easy UI|举报|字号 订阅 可以使用$.parser.pa ...
- ios/iphone手机请求微信用户头像错位BUG及解决方法
转:http://www.jslover.com/code/527.html ios/iphone手机请求微信用户头像错位BUG及解决方法 发布时间:2014-12-01 16:37:01 评论数:0 ...
- IOS开发证书变成“此证书的签发者无效”解决方法
IOS开发证书全部变成无效,如下图 打包提示错误 解决方法: 1. 下载https://developer.apple.com/certificationauthority/AppleWWDRCA ...
随机推荐
- leetcode Database3
一.Rank Scores Write a SQL query to rank scores. If there is a tie between two scores, both should ha ...
- 《OD学算法》常用算法集合
1. 排序 (1)冒泡 (2)选择 (3)插入 (4)归并 2. 位运算 Bitmask provide an efficient way to manipulate a small set of B ...
- Java里面instanceof怎么实现的
开始完全一头雾水呀,后面看了Java指令集的介绍,逐渐理解了. https://www.zhihu.com/question/21574535/answer/18998914 下面这个答案比较直白 你 ...
- 移动WebApp开发框架(珍藏)
1.Jquery Mobilehttp://demos.jquerymobile.com/1.4.5/button-markup/http://andymatthews.net/code/jQuer ...
- Qt之QHeaderView自定义排序(QSortFilterProxyModel)
简述 对以上节的排序,我们衍伸了两点: 把一个字符串前面的数据按照字符串比较,而后面的数据按照整形比较. 将整形显示为字符串,而排序依然正常呢. 为了分别描述,这里我们先解决问题1. 简述 效果 处理 ...
- 修改Eclipse格式化代默认长度
eclipse 默认设置的换行长度为80, 格式化代码后,同一个方法里面参数也经常被,换行,非常难看 1.Java代码打开Eclipse的Window菜单,然后 Preferences->Jav ...
- HDU 4998 (点的旋转) Rotate
为了寻找等效旋转操作,我们任选两个点P0和Q0,分别绕这n个点旋转一定的角度后最终得到Pn和Qn 然后已知:P0和Pn共圆,Q0和Qn共圆.所以要找的等效旋转点就是这两个线段的垂直平分线交点O. 等效 ...
- Maven之 环境搭建
这几天开始了maven的学习,看了孔浩老师的视频(http://pan.baidu.com/s/1o7bg2h0),以及黄勇大牛的博客(http://my.oschina.net/huangyong/ ...
- codevs 4927 线段树练习5
赶在期末考试之前把这道傻逼题调了出来. #include<iostream> #include<cstdio> #include<cstring> #include ...
- jquery响应回车事件
简单地记下jquery实现回车事件,代码如下: 全局: $(function(){document.onkeydown = function(e){ var ev = document.all ...