• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Are there any NSUserDefaults keys which aren't valid?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Are there any NSUserDefaults keys which aren't valid? (From: Jonathan del Strother <email@hidden>)
 >Re: Are there any NSUserDefaults keys which aren't valid? (From: Matt Gough <email@hidden>)

  • Prev by Date: Re: Are there any NSUserDefaults keys which aren't valid?
  • Next by Date: CoreData: Intermittent crash in -[NSSQLRow dealloc]
  • Previous by thread: Re: Are there any NSUserDefaults keys which aren't valid?
  • Next by thread: Re: Are there any NSUserDefaults keys which aren't valid?
  • Index(es):
    • Date
    • Thread