Re: NSKeyedUnarchiver replaces NSStrings
Re: NSKeyedUnarchiver replaces NSStrings
- Subject: Re: NSKeyedUnarchiver replaces NSStrings
- From: Björn Carlström <email@hidden>
- Date: Mon, 22 Mar 2004 22:12:36 +0100
Philippe
I'm kind of new at Cocoa programming. Are you sure this is a bug and
how would one go about reporting such an animal?
best
Bjvrn
2004-03-22 kl. 16.02 skrev Philippe Mougin:
Bjorn,
Seems you've found a bug in the Cocoa archiving system. The doc states
that "The archive preserves the identity of every object in the graph
and all the relationships it has with all the other objects in the
graph". And, indeed, this is the behavior we need for a useful object
archiving system.
A quick test with NSNumber objects show that the problem is not
limited to NSString objects: same problem observed here with
NSNumbers.
Note, however, that mutable strings do not seems to be subject to this
problem: their relative identity in the graph is preserved.
I wonder if the issue only applies to immutable objects. This would be
extremely less severe than if not, because the notion of object
identity is much less used when dealing with immutable objects. This
would still be quite a problem, though, and would hint more at a
design flaw in the implementation than at an unintentional bug.
Best,
Philippe Mougin
> I'm using NSKeyedArchiver to save my documents. Some
> of my objects are refering the same instance of NSString,
> When unarchiving the file, NSKeyedUnarchiver creates a
> several copies of NSString instead of returning the same
> instance over and over. All other objects apart from NSString
> works correctly. I've examined the saved file and from
> what I can tell the string is only saved once so the problem
> seems to be in the unarchiving.
>
> Does NSString work differently when decoded than other
> objects or is there something else I am missing here?
>
> Any suggestiones or help apreciated
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.