iOS 缓存清理问题
高洛峰
高洛峰 2017-04-17 17:46:42
0
3
381

app如何实现每隔一周自动清理一次缓存

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(3)
刘奇

I thought of a method and it was ok. Add an attribute to NSUserDefaults. In Appdelegate, first check whether there is this attribute to determine whether it is the first time to install the app. If not, it means it is the first time to install the app. Add this attribute. This attribute means The time to clear the cache, the first time is assigned the current system time.
Then every time you open the app, compare this time with the current system time. If the current system time is 7 days greater than this attribute, remove the Cache folder, otherwise do nothing. The original problem was how to determine whether the app was installed for the first time on the mobile phone. Later I learned that you can determine whether there is a custom attribute in NSuserdeafults to determine whether the app is installed for the first time, and the problem was solved

Ty80

Record the time of the last cleanup, compare it with the last time after opening >=7 days to clear the cache, and record the current time.

刘奇

Egocache

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template