开发者

Retrieve Data and Time info from plist file

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜