• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
issues encoding MailMessage and NSData
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: issues encoding MailMessage and NSData
      • From: Reza Farhad <email@hidden>
    • Re: issues encoding MailMessage and NSData
      • From: Benjamin Stiglitz <email@hidden>
  • Prev by Date: Two untitled documents opening
  • Next by Date: [iPhone] Any way to animate a tab-bar away?
  • Previous by thread: Two untitled documents opening
  • Next by thread: Re: issues encoding MailMessage and NSData
  • Index(es):
    • Date
    • Thread