在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 關注
- 161 瀏覽
添加回答
舉報
0/150
提交
取消