• 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
registerDefaults error and NSCoding protocol
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

registerDefaults error and NSCoding protocol


  • Subject: registerDefaults error and NSCoding protocol
  • From: John Clayton <email@hidden>
  • Date: Thu, 27 Nov 2008 20:56:05 +0100

Hi,

Question about registering defaults - I'd assumed the following would be valid, assuming that GuideSettings implements the NSCoding protocol - but my app doesn't like this and throws a bad access exception in CFRetain when I run this code:

The bit that falls over is the registerDefaults: call - the stack track being:

#0	0x96fc52d4 in CFRetain
#1	0x96f94a54 in CFDictionarySetValue
#2	0x97029dd3 in -[CFXPreferencesSource setValue:forKey:]
#3	0x9702acce in __CFXPreferencesSetValuesInSource
#4	0x9702e30d in _CFXPreferencesRegisterDefaultValues
#5	0x92b90a98 in -[NSUserDefaults(NSUserDefaults) registerDefaults:]
#6	0x000ae543 in -[DataModelDefaults init] at DataModelDefaults.m:90


- (id) init { self = [super init]; _defs = [NSUserDefaults standardUserDefaults]; NSArray* defaultGuides = [DataModelDefaults defaultGuideSettings]; NSDictionary* defs = [NSDictionary dictionaryWithObjectsAndKeys: defaultGuides, kGuideSettings, [NSNumber numberWithFloat:2], kEffectDefaultsDurationSeconds, 0]; // this goes BOOOOOM [_defs registerDefaults:defs];

	return self;
}

+ (NSArray *) defaultGuideSettings {
// simply return a list of the guide objects we want to have as defaults
NSMutableArray* array = [[NSMutableArray new] autorelease];
[array addObject:[GuideSetting guideSettingNamed:@"Standard" width: 640 height:480]];
[array addObject:[GuideSetting guideSettingNamed:@"Standard" width: 800 height:600]];
[array addObject:[GuideSetting guideSettingNamed:@"YouTube" width:848 height:480]];
return array;
}


Am I forgetting something? I thought as long as my object could encode/ decode itself, all would be OK - anyone know what I'm doing wrong?

Thanks
--
John Clayton
Skype: johncclayton




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: registerDefaults error and NSCoding protocol
      • From: Bill Bumgarner <email@hidden>
  • Prev by Date: RE: cString
  • Next by Date: Re: registerDefaults error and NSCoding protocol
  • Previous by thread: Re: cString
  • Next by thread: Re: registerDefaults error and NSCoding protocol
  • Index(es):
    • Date
    • Thread