On Apr 14, 2014, at 21:10 , Varun Chandramohan <varun.chandramo...@wontok.com> 
wrote:

> I was thinking what if I want to keep this persistent?

This doesn’t sound like such a good idea. There’s nothing to guarantee that 
your saved data will actually match the state of the file system the next time 
you read it back. In particular, the NSURL class reference says of 
‘NSURLFileResourceIdentifierKey’:

> The value of this identifier is not persistent across system restarts.

However, it seems to me it’s a little worse than that. The file system can 
change behind your back at any time. Even resource identifiers you may have 
kept in memory while your app is running have the potential to become 
invalidated from one moment to the next.

Since (it sounds from your earlier description), the way you *really* know 
which files/folders are restricted is by name (that is, essentially by path), 
you might be better off basing your comparisons on -[NSURL isEqual:] after all, 
or perhaps even comparisons of -[NSURL path]. Note that if the NSURLs you’re 
checking come from a directory enumerator, they will have a consistent 
structure (and the correct case). If you’re careful constructing your set of 
restricted URLs, there shouldn’t be a problem about doing the name-string-based 
comparison I’m suggesting.




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to