Re: Are there any NSUserDefaults keys which aren't valid?
Re: Are there any NSUserDefaults keys which aren't valid?
- Subject: Re: Are there any NSUserDefaults keys which aren't valid?
- From: Jonathan del Strother <email@hidden>
- Date: Thu, 26 Jan 2006 23:02:39 +0000
Thanks for the various thoughts ....
On 26 Jan 2006, at 20:34, j o a r wrote:
On 26 jan 2006, at 20.59, Jonathan del Strother wrote:
NSDate* fileDate = [[[NSFileManager defaultManager]
fileAttributesAtPath:file traverseLink:YES]
objectForKey:NSFileModificationDate];
[1]
Do you guard against a nil return value from this method call? Note
that the sample code in the documentation for this method has such
guards!
Is it possible that your users are on some non-standard file
system, like NFS, FAT, et.c.? Perhaps you should try your app on
something like that and see how it works?
Note that all file attributes are not supported on all file
systems! I filed a bug about two years ago (still open) that
NSFileCreationDate returns *incorrect* values (ie. not *nil*, a
date from 1904 IIRC) on NFS.
That said, if this had been the problem - (nil == fileDate) - you
would have received an exception in "-setObject:forKey:", and not
when setting the value in user defaults.
I'm not actually guarding against nil - but like you say, that
problem would show up when setting the nil value in the NSDictionary.
[2]
The other variable that I forgot to ask about is the key
"albumKey". How to you generate it?
albumKey = [NSString stringWithFormat:@"%@ - %@", [self artist],
[self title]];
artist & title are NSStrings, indirectly culled from the iTunes XML.
Neither will be nil.
[3]
Are "fileDate" and "albumKey" both created in the same thread as
where you write to user defaults?
Yes.
I'm going to go play with threads, see if I can persuade this to
crash on my own machine again...
Jon
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden