Skip navigation.
 
mlRe: Re: Odd problem using NSCoding
FROM : <java_nutt
DATE : Wed Apr 06 13:48:21 2005

TradeModel is a subclass of NSObject, which doesn't conform to NSCoding, so I don't need to call super's initWithCoder.  And in TradeModel.h, I do have:

@interface TradeModel : NSObject <NSCoding>

The problems seems to be in initWithCoder when I call [super init].  I can save just fine with encodeWithCoder.  Per your instructions, initWithCoder now starts like:

- (id)initWithCoder:(NSCoder*)coder
{
  if (self = [super init]) { // calling NSObject's init:
  // ...
}

I set a breakpoing on this method, and as soon as the debugger tries to hit this method, I get the same error about copyWithZone.  I've never encountered this before, and like I said, I have another app that works exactly the same and I don't get any errors.

Do I need to override copyWithZone?  If so, how do you suggest I do this?  I'll be hitting Cocoabuilder.com and searching the archives as well, but I thought I'd ask since I have you here.  :)  Thanks again, Rick.  Oh, and I switched everything over to encode/decodWithObject/int: forKey: as well.  Thanks for the tip.

James

Related mailsAuthorDate
mlOdd problem using NSCoding <java_nutt Apr 6, 09:37
mlRe: Odd problem using NSCoding Ricky Sharp Apr 6, 13:13
mlRe: Re: Odd problem using NSCoding <java_nutt Apr 6, 13:48
mlRe: Re: Odd problem using NSCoding Ricky Sharp Apr 6, 15:00
mlRe: Odd problem using NSCoding Kevin Callahan Apr 9, 06:42