FROM : Shawn Erickson
DATE : Sun Apr 10 22:23:55 2005
On Apr 10, 2005, at 1:03 PM, David Rocamora wrote:
> Here is the part that returns NSData of the archived object and it's
> data:
>
> - (NSData *)dataRepresentationOfType:(NSString *)aType
> {
> NSLog(@"artworks: %@", artworks);
> return [NSArchiver archivedDataWithRootObject:artworks];
> }
What does the code look like that unarchives it?
> Here is what NSLog says with the very same array as before when this
> method is run:
>
> artworks: <CFArray 0x3029b0 [0xa01900e0]>{type = mutable-small, count
> = 1, values = (
> 0 : <Artwork: 0x330ab0>
> )}
Can you clarify the above... it isn't clear if the log statement before
archiving (archivedDataWithRootObject:) is the one listed above and
hence your array doesn't contain what you expect when you do to archive
it.
> Looking closely at this now I notice that the addresses to the two
> arrays show that they are actually two different arrays. The init
> method appears to be creating two different arrays. I do not know why
> this is happening. Here is the init code:
You are unarchiving an object so you will get back a different object
graph then the one you archived but it will contain the same
information as the one you archived (assuming the archive/unarchive
process is correct) so expect different pointers to be listed in the
NSLog output.... or am I not understand the framing of this
question/concern?
Note if you want better information in you NSLog statements override
-description in you Artwork class.
> - (id)init
> {
> if ( self = [super init]) {
> artworks = [[NSMutableArray alloc] init];
> activeSet = artworks;
> [self createNewArtwork];
> }
> }
>
> It seems to be running init twice. Why is this happening? Is there a
> way to design around this?
What class is this init code in? Who is calling this init?
You still have us mostly in the dark here... if you want help I suggest
you list all code that touches artworks or walk thru that code that
touches it with the debugger (set a break point at all lines that touch
this variable).
-Shawn
DATE : Sun Apr 10 22:23:55 2005
On Apr 10, 2005, at 1:03 PM, David Rocamora wrote:
> Here is the part that returns NSData of the archived object and it's
> data:
>
> - (NSData *)dataRepresentationOfType:(NSString *)aType
> {
> NSLog(@"artworks: %@", artworks);
> return [NSArchiver archivedDataWithRootObject:artworks];
> }
What does the code look like that unarchives it?
> Here is what NSLog says with the very same array as before when this
> method is run:
>
> artworks: <CFArray 0x3029b0 [0xa01900e0]>{type = mutable-small, count
> = 1, values = (
> 0 : <Artwork: 0x330ab0>
> )}
Can you clarify the above... it isn't clear if the log statement before
archiving (archivedDataWithRootObject:) is the one listed above and
hence your array doesn't contain what you expect when you do to archive
it.
> Looking closely at this now I notice that the addresses to the two
> arrays show that they are actually two different arrays. The init
> method appears to be creating two different arrays. I do not know why
> this is happening. Here is the init code:
You are unarchiving an object so you will get back a different object
graph then the one you archived but it will contain the same
information as the one you archived (assuming the archive/unarchive
process is correct) so expect different pointers to be listed in the
NSLog output.... or am I not understand the framing of this
question/concern?
Note if you want better information in you NSLog statements override
-description in you Artwork class.
> - (id)init
> {
> if ( self = [super init]) {
> artworks = [[NSMutableArray alloc] init];
> activeSet = artworks;
> [self createNewArtwork];
> }
> }
>
> It seems to be running init twice. Why is this happening? Is there a
> way to design around this?
What class is this init code in? Who is calling this init?
You still have us mostly in the dark here... if you want help I suggest
you list all code that touches artworks or walk thru that code that
touches it with the debugger (set a break point at all lines that touch
this variable).
-Shawn
| Related mails | Author | Date |
|---|---|---|
| David Rocamora | Apr 10, 19:58 | |
| Serge Meynard | Apr 10, 20:30 | |
| David Rocamora | Apr 10, 22:03 | |
| Shawn Erickson | Apr 10, 22:23 | |
| David Rocamora | Apr 10, 22:56 | |
| Serge Meynard | Apr 11, 00:00 | |
| David Rocamora | Apr 11, 00:34 | |
| Serge Meynard | Apr 11, 00:45 | |
| David Rocamora | Apr 11, 01:22 | |
| Serge Meynard | Apr 11, 01:59 | |
| mmalcolm crawford | Apr 11, 03:37 | |
| David Rocamora | Apr 11, 18:01 |






Cocoa mail archive

