开发者

Retrieve Data and Time info from plist file

开发者 https://www.devze.com 2023-02-13 06:44 出处:网络
I am downloading data from a web site, storing it in an array and writing it to a plist file in my iPhone app.

I am downloading data from a web site, storing it in an array and writing it to a plist file in my iPhone app.

How would I check the file-date/time on the file to see when it was saved?

I may be approaching this the wrong way but what I'm trying to do is check if the file is older开发者_Python百科 than n minutes and if so, download a new copy and replace it.


You can use the NSFileManager and retrieve attributes with attributesOfItemAtPath:error:. There is an attribute called NSFileModificationDate, which should point to a date you can use for a date comparison.

You could as well put a timestamp in the filename and test against that one: will lead to some parsing work. Or add a timestamp property to your plist that reflects creation time.

0

精彩评论

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