Reputation: 835
My app downloads files from the internet. App stores them in Documents folder . App uses iTunes Sharing feature, and user can store files in Documents folder through iTunes (when my application is launched and when my app is not launched). In one of tableviews in my app I want to present files from Documents directory sorted by Date added (date, when files were added to Documents directory). Is there any file attribute like "Date Added" on iOS? How can I retrieve it? I searched for this, but I cannot found an answer for now.
I think I can save the date for downloaded files and files that were added through iTunes when my app was launched, using DirectoryWatcher. But I don't know how can I get the "date added" for files that were stored in Documents through iTunes when my app was not launched. How can I do this?
I know that there is Arrange by Date Added in Finder on Mac OS 10.7. How they do it?
Thank you.
Upvotes: 3
Views: 1454
Reputation: 835
I found that file does not contain Date Added in its attributes. After copying files through iTunes Connect from mac to app creation date and modification date remains unchanged (as they were on the mac). Also I found that Finder on Mac uses external sqlite database ~/Library/Preferences/com.apple.dock.db for storing Date Added attribute.
So for my needs I have decided to use some kind of external database for storing "date added" value. I think I will use NSUserDefaults, and I will use filename and inode number as a key.
Upvotes: 0
Reputation: 392
Yes you can use NSFileManager to do this, you can give it a file path to request a dictionary of attributes, one being the modification date
Upvotes: 2