Re: quick and dirty NSData implosion

2009-05-11 Thread Andy Lee
On May 11, 2009, at 4:20 PM, jon wrote: bookMarkurlString = [c decodeObjectForKey:@"bookMarkurlString"]; bookMarkTitle = [c decodeObjectForKey:@"bookMarkTitle"]; You need to retain these. The doc for decodeObjectForKey: says "Decodes and returns an autoreleased Objective-C ob

Re: quick and dirty NSData implosion

2009-05-11 Thread Michael Ash
On Mon, May 11, 2009 at 10:00 PM, Graham Cox wrote: > What's a slight nuisance with this rule is that if I change what my class > inherits from, I will have to revisit my -initWithCoder: method to possibly > call super's initWithCoder: instead of super's designated initializer. If my > method was

Re: quick and dirty NSData implosion

2009-05-11 Thread jon
On May 8, 2009, at 6:56 PM, Graham Cox wrote: You can help yourself out with this type of thing by declaring your classes properly. If you need it to be NSCoding compliant (as you do), then ensure it subscribes to the protocol: @interface BookMark : NSObject I think i have the Protocol

Re: quick and dirty NSData implosion

2009-05-11 Thread Graham Cox
On 12/05/2009, at 11:36 AM, Adam R. Maxwell wrote: On May 11, 2009, at 6:11 PM, Graham Cox wrote: On 12/05/2009, at 6:20 AM, jon wrote: - (id)initWithCoder:(NSCoder *)c { [super init]; You do not and should not call [super init] here. In this case it's harmless as it happens,

Re: quick and dirty NSData implosion

2009-05-11 Thread Adam R. Maxwell
On May 11, 2009, at 6:11 PM, Graham Cox wrote: On 12/05/2009, at 6:20 AM, jon wrote: - (id)initWithCoder:(NSCoder *)c { [super init]; You do not and should not call [super init] here. In this case it's harmless as it happens, but in the general case it's not. The only thing in

Re: quick and dirty NSData implosion

2009-05-11 Thread Graham Cox
On 12/05/2009, at 6:20 AM, jon wrote: @property(readwrite, assign) int bookMarkCount; @property(readwrite, assign) NSString *bookMarkurlString; @property(readwrite, assign) NSString *bookMarkTitle; 'assign' means the property is a simple assignment, such as ivar = foo; Therefore your string

Re: quick and dirty NSData implosion

2009-05-08 Thread Graham Cox
On 09/05/2009, at 12:35 AM, jon wrote: @interface BookMark : NSObject You can help yourself out with this type of thing by declaring your classes properly. If you need it to be NSCoding compliant (as you do), then ensure it subscribes to the protocol: @interface BookMark : NSObject T

Re: quick and dirty NSData implosion

2009-05-08 Thread jon
sorry, I am getting emails out of order because i'm using the option that sends list in a bundle, so getting the ones that reply directly to me first, so i am looking for Dave's answer now... thanks, Jon. On May 8, 2009, at 8:40 AM, Alexander Spohr wrote: So what are you asking for? It’s

Re: quick and dirty NSData implosion

2009-05-08 Thread Alexander Spohr
Am 08.05.2009 um 16:35 schrieb jon: NSData blew up because: *** -[BookMark encodeWithCoder:]: unrecognized selector sent to instance 0x1f900a40 So what are you asking for? It’s right there in your face: Your BookMark does not implement encodeWithCoder: an is therefore not NSCoding complia

Re: quick and dirty NSData implosion

2009-05-08 Thread Dave DeLong
This is a clear indication that your BookMark class does not conform to NSCoding. Check the docs on what NSCoding is and how to use it. If you implement the two required methods (initWithCoder: and encodeWithCoder:), your code should work just fine. Dave On May 8, 2009, at 8:35 AM, jon w

Re: quick and dirty NSData implosion

2009-05-08 Thread jon
in the debugger, here are the last lines it followed... #0 0x91b35de9 in -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] #1 0x91b35b07 in -[NSMenu performKeyEquivalent:] #2 0x91b343ac in -[NSApplication _handleKeyEquivalent:] #3 0x91a5116b in -[NSApplication se

Re: quick and dirty NSData implosion

2009-05-08 Thread Dave DeLong
Not quite. It can if it's encoded first (with something like NSKeyedArchiver, and it can only be archived if it conforms to NSCoding. Dave On May 8, 2009, at 8:14 AM, Keary Suska wrote: ...your BookMark class cannot be stored in defaults... ___

Re: quick and dirty NSData implosion

2009-05-08 Thread Keary Suska
On May 8, 2009, at 7:56 AM, jon wrote: yes i did try, i would send the data, and nothing would show up in the property list file. but there would be no crash, no error, nothing, but no results either. so after reading the same documentation you also saw, I assumed it had to be NSD

Re: quick and dirty NSData implosion

2009-05-08 Thread Dave DeLong
And just to make sure... your Bookmark class does implement NSCoding, correct? That's required by NSKeyedArchiver. Dave On May 8, 2009, at 8:05 AM, Alexander Spohr wrote: Am 08.05.2009 um 15:56 schrieb jon: [defaults setObject:bookMarkList forKey:PECBookMarkListKey]; so again, I

Re: quick and dirty NSData implosion

2009-05-08 Thread Alexander Spohr
Am 08.05.2009 um 15:56 schrieb jon: [defaults setObject:bookMarkList forKey:PECBookMarkListKey]; so again, I must be doing something fundamentally wrong here? Yes. Your BookMark-instance is not a property list object. So you could store the NSMutableDictionary, but it holds an ille

Re: quick and dirty NSData implosion

2009-05-08 Thread John Cebasek
Why don't you do something like this: @try { [defaults setObject:bookMarkList forKey:PECBookMarkListKey]; } @catch (NSException *e) { NSLog(@"NSData blew up because: %@", [e reason]); } and find out what the error is? John On 8-May-09, at 9:56 AM, jon wrote: yes i did try, i would

Re: quick and dirty NSData implosion

2009-05-08 Thread jon
yes i did try, i would send the data, and nothing would show up in the property list file. but there would be no crash, no error, nothing, but no results either. so after reading the same documentation you also saw, I assumed it had to be NSDictionary, rather than NSMutableDictionar

Re: quick and dirty NSData implosion

2009-05-08 Thread Alexander Spohr
Am 08.05.2009 um 15:25 schrieb Jon: but NSUserDefaults only takes immutable things. Why do you think that? Did you try? From the documentation: "value The object to store in the defaults database. A default’s value can be only property list objects: NSData, NSString, NSNumber, NSDate, NS

quick and dirty NSData implosion

2009-05-08 Thread Jon
so far, what i've determined by dumbing this down, is that I must be doing something inherently bad and nubi like here... the run time just completely implodes when it gets to the "NSData" line of code any help would be great, thanks in advance. the "BookMark" is just a class with th