在applicationDidEnterBackground直接NSLog的时候,是可以在退出的时候打印出来的。但是,如果我在这个段代码里运行一个比较好性能的代码,例如回写缓存之类的。
1 回答
小怪兽爱吃肉
TA贡献1852条经验 获得超1个赞
这个方法本来就是用来回写缓存,保存装态之类的吧。至于时间
“Your implementation of this method has approximately five seconds to perform any tasks and return. If you need additional time to perform any final tasks, you can request additional execution time from the system by calling beginBackgroundTaskWithExpirationHandler:. In practice, you should return from applicationDidEnterBackground: as quickly as possible. If the method does not return before time runs out your application is terminated and purged from memory.”
默认有5秒,如果不够可以用beginBackgroundTaskWithExpirationHandler:来延长,这个我没用过,可以google一下。
一般5秒应该够吧了
- 1 回答
- 0 关注
- 133 浏览
添加回答
举报
0/150
提交
取消