Re: Fast NSArray compare
Re: Fast NSArray compare
- Subject: Re: Fast NSArray compare
- From: Quincey Morris <email@hidden>
- Date: Mon, 14 Apr 2014 21:45:42 -0700
On Apr 14, 2014, at 21:10 , Varun Chandramohan <email@hidden> 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 (email@hidden)
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:
This email sent to email@hidden