开发者

Delete file after a required number of days

开发者 https://www.devze.com 2023-04-05 14:49 出处:网络
In my iphone application, i want to delete files automatically after a particular number of days from the creation of the file.The number of days after the file are to be deleted can be given by the u

In my iphone application, i want to delete files automatically after a particular number of days from the creation of the file.The number of days after the file are to be deleted can be given by the user.I store the Date and Time of creation of 开发者_开发知识库file. How to perform this? All valuable suggestions are appreciated.Thanks.


Every time when user run the app you check with the date and delete the file by using

NSFileManager *fileManager = [NSFileManager defaultManager];
[fileManager removeItemAtPath:myPath error:NULL];


You could take a look at the [local] notification service, just handling the notification under the hood, without a user alert...

http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/IPhoneOSClientImp/IPhoneOSClientImp.html#//apple_ref/doc/uid/TP40008194-CH103-SW4

0

精彩评论

暂无评论...
验证码 换一张
取 消