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
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 mails | Author | Date |
|---|---|---|
| <java_nutt | Apr 6, 09:37 | |
| Ricky Sharp | Apr 6, 13:13 | |
| <java_nutt | Apr 6, 13:48 | |
| Ricky Sharp | Apr 6, 15:00 | |
| Kevin Callahan | Apr 9, 06:42 |






Cocoa mail archive

