Re: Preferences binding update NSTextField and user defaults
site_archiver@lists.apple.com Delivered-To: cocoa-dev@lists.apple.com Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=googlemail.com; h=received:mime-version:in-reply-to:references:content-type:message-id:subject:date:to:x-mailer:from; b=oXnEcLKFPy7cdboPMLlJbqTzDQJQyRJp5fS+Mf+xnb6dH6V0ImEdZ2GMbEhim4o/eyzN7lfU9rIf5HfojhxzSgDKLiZ8eZ1Ha9pRVRdq7FJaEfmg8LkcOYTJCUH/vL+UvKYollZ4GpwJrMr0WPtqFiKfetFw3zaS1PmCSpON1g8= + (void)setupDefaults { NSString *userDefaultsValuesPath; NSDictionary *userDefaultsValuesDict; } On Dec 28, 2006, at 2:38 PM, Scott Stevenson wrote: On Dec 27, 2006, at 2:52 PM, Ferhat Ayaz wrote: - Scott _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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/site_archiver%40lists.apple... you're right. But I've also this part in my code, which will catch all not assigned defaults. // load the default values for the user defaults userDefaultsValuesPath=[[NSBundle mainBundle] pathForResource:@"UserDefaults" ofType:@"plist"]; userDefaultsValuesDict=[NSDictionary dictionaryWithContentsOfFile:userDefaultsValuesPath]; // set them in the standard user defaults [[NSUserDefaults standardUserDefaults] registerDefaults:userDefaultsValuesDict]; aja, thanks. This is a work around due to leak of auto increment in CoraData. - (void)awakeFromInsert { [super awakeFromInsert]; NSUserDefaultsController *defaults = [NSUserDefaultsController sharedUserDefaultsController]; NSString *num = [[defaults values] valueForKey:@"Counter"]; int counter = [num intValue]; [[defaults values] setValue:[NSString stringWithFormat:@"% d",counter+1] forKey:@"Counter"]; NSString *format = [[defaults values] valueForKey:@"Format"]; [self setValue:[NSString stringWithFormat:format,counter] forKey:@"nr"]; [self setValue:[NSDate date] forKey:@"creationDate"]; } This probably won't work if the user deletes the application plist file, which is pretty common. Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/ferhat.ayaz% 40googlemail.com This email sent to ferhat.ayaz@googlemail.com This email sent to site_archiver@lists.apple.com
participants (1)
-
Ferhat Ayaz