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 18:17:23 +0000
On 26 Jan 2006, at 18:11, Matt Gough wrote:
On 26 Jan 2006, at 17:57, Jonathan del Strother wrote:
NSMutableDictionary* newFileDates = [[[NSUserDefaults
standardUserDefaults] objectForKey:@"File Dates"] mutableCopy];
if there is not already a "File Dates" in the defaults then you
will get nil returned.
[newFileDates setObject:fileDate forKey:albumKey];
This will do nothing with a nil newFileDates.
[[NSUserDefaults standardUserDefaults] setObject:newFileDates
forKey:@"File Dates"];
This will crash trying to add a nil object.
Hope your bug is as simple as that
Good idea, but I already set up a blank NSDictionary with
+(void)initialize
{
NSDictionary* defaults = [[NSDictionary alloc] initWithObjectsAndKeys:
[NSDictionary dictionary], @"File Dates", nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:defaults];
[defaults release];
}
So unless there's some bizarre way in which that can fail, that
should be the problem.
Thanks for the suggestion, though
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