Hi all

I am trying to save a MailMessage that I obtain from Apple Mail using scripting bridge.

I get the message and I check to see if it does conform to NSCoding protocols, which it does.

[ message conformsToProtocol:@protocol(NSCoding)]

then I go to encode it in my encodeWithCoder call

- (void)encodeWithCoder:(NSCoder *)encoder
{
        [ encoder encodeObject:message forKey:@"message" ];
}


that works fine, but when I go to decode the object I get the following error:

exception raised:*** -decodeObjectForKey: only defined for abstract class. Define -[NSKeyedArchiver decodeObjectForKey:]!

I even tried to convert the message object to NSData and then encode it:

- (void)encodeWithCoder:(NSCoder *)encoder
{
        NSData *data = [ NSKeyedArchiver archivedDataWithRootObject:message ];
        [ encoder encodeObject:data forKey:@"message" ];
}

however still I get the same error when trying to decode the data

        NSData *returnData = [ encoder decodeObjectForKey:@"message" ];

Thanks



_______________________________________________

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

Reply via email to