FROM : David Rocamora
DATE : Sun Apr 10 22:03:07 2005
This is the code that has a full array in it.
- (void)createNewArtwork
{
Artwork *newArtwork = [[Artwork alloc] init];
[artworks addObject:newArtwork];
[newArtwork release];
NSLog(@"artworks is: %@", artworks);
}
When createNewArtwork adds a third object to the array NSLog says this:
artworks is: <CFArray 0x3524a0 [0xa01900e0]>{type = mutable-small,
count = 3, values = (
0 : <Artwork: 0x3524b0>
1 : <Artwork: 0x3b4d40>
2 : <Artwork: 0x3b46d0>
)}
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];
}
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>
)}
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:
- (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?
Thanks again!
Dave
On Apr 10, 2005 2:30 PM, Serge Meynard <<email_removed>> wrote:
>
> It might help if you posted the significant sections of your code...
> How are you doing the load and save exactly?
>
> By the way, you should probably be using NSKeyedArchiver instead of
> NSArchiver.
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
>
DATE : Sun Apr 10 22:03:07 2005
This is the code that has a full array in it.
- (void)createNewArtwork
{
Artwork *newArtwork = [[Artwork alloc] init];
[artworks addObject:newArtwork];
[newArtwork release];
NSLog(@"artworks is: %@", artworks);
}
When createNewArtwork adds a third object to the array NSLog says this:
artworks is: <CFArray 0x3524a0 [0xa01900e0]>{type = mutable-small,
count = 3, values = (
0 : <Artwork: 0x3524b0>
1 : <Artwork: 0x3b4d40>
2 : <Artwork: 0x3b46d0>
)}
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];
}
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>
)}
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:
- (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?
Thanks again!
Dave
On Apr 10, 2005 2:30 PM, Serge Meynard <<email_removed>> wrote:
>
> It might help if you posted the significant sections of your code...
> How are you doing the load and save exactly?
>
> By the way, you should probably be using NSKeyedArchiver instead of
> NSArchiver.
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
>
| 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

