issues encoding MailMessage and NSData
issues encoding MailMessage and NSData
- Subject: issues encoding MailMessage and NSData
- From: Reza Farhad <email@hidden>
- Date: Fri, 22 May 2009 11:31:02 +0100
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 (email@hidden)
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:
This email sent to email@hidden