Surprisingly, I could find no reference to this issue.
In the archives, there seems to be, lately, the consensus ( I hope)
that direct ivar access is preferred in 2 methods ie init and dealloc.
This would seem to imply that initWithCoder/encodeWithCoder should
also use direct ivar access, but I have seen **both** used in
reputable sources.
So, from Apple's docs on archiving this:
- (void)encodeWithCoder:(NSCoder *)coder {
[super encodeWithCoder:coder];
[coder encodeObject:mapName forKey:@"MVMapName"];
[coder encodeFloat:magnification forKey:@"MVMagnification"];
[coder encodeObject:legendView forKey:@"MVLegend"];
[coder encodeConditionalObject:auxiliaryView forKey:@"MVAuxView"];
}
and from the binding examples on mmalc's page, this: ( I understand
that the method is deprecated)
- (NSData *)dataRepresentationOfType:(NSString *)aType
{
// create an archive of the collection and its attributes
NSKeyedArchiver *archiver;
NSMutableData *data = [NSMutableData data];
archiver = [[NSKeyedArchiver alloc]
initForWritingWithMutableData:data];
[archiver encodeObject:self.name forKey:@"name"];
[archiver encodeObject:self.collectionDescription
forKey:@"collectionDescription"];
[archiver encodeObject:self.collection forKey:@"collection"];
[archiver finishEncoding];
return data;
}
Is this just 6 of one and half dozen of the other?
Thanks.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (xcode-us...@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/mdeh%40comcast.net
This email sent to m...@comcast.net
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com