Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSUserDefaults won't do as it's told



Are there errors at runtime? NSAttributedString is not a property list type. NSString is, however.

Also, you leak a lot in this code.

Ack, at 3/3/07, email@hidden said:

   That is, the return value is nil, and the code just executed was all in
vain ! As usual, I
must be missing something obvious ...
   Below is the aforementioned code for the "initialize" method :

+(void) initialize
{
   NSMutableDictionary* defaultValues=[NSMutableDictionary dictionary];
   NSData* yellowData=[NSKeyedArchiver archivedDataWithRootObject:[NSColor
yellowColor]];
   NSData* greenData=[NSKeyedArchiver archivedDataWithRootObject:[NSColor
greenColor]];
   [defaultValues setObject:[[NSAttributedString alloc]
initWithString:@"\n%"] forKey:GGPeggyHeaderContentKey];
   [defaultValues setObject:[[NSAttributedString alloc]
initWithString:@"\n%"] forKey:GGPeggyFooterContentKey];
   [defaultValues setObject:yellowData forKey:GGPeggyHeaderColorKey];
   [defaultValues setObject:greenData forKey:GGPeggyFooterColorKey];
   [defaultValues setObject:[NSNumber numberWithBool:YES]
forKey:GGMultiplePageViewBooleanKey];

   [[NSUserDefaults standardUserDefaults] registerDefaults: defaultValues];

}


Note : there are no warnings during the compile phase.

--


Sincerely, Rosyna Keller Technical Support/Carbon troll/Always needs a hug

Unsanity: Unsane Tools for Insanely Great People

It's either this, or imagining Phil Schiller in a thong.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >NSUserDefaults won't do as it's told (From: email@hidden)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.