• 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
Re: Losing attachments when saving rtfd
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Losing attachments when saving rtfd


  • Subject: Re: Losing attachments when saving rtfd
  • From: Douglas Davidson <email@hidden>
  • Date: Wed, 25 Apr 2012 10:37:12 -0700

On Apr 24, 2012, at 9:31 AM, Matthew Weinstein wrote:

> Trying to save an RTFD from an NSAttributedString with attachements. The text saves; the images don't...
>
> I've been scouring the web but can't seem to figure out what's wrong.
>
> I have a NSAttributedString with attachments. I check that the string really has the attachments by using setAttributedString to the textstorage of a NSTextView, and voila, there it is.
>
> But I can't seem to save the attachment. This is what I'm trying:
>
> 	//this is a category I found on the interwebs
> 	myimagets = [[NSTextAttachment alloc] initWithAnImage: myimage];
> 	//get doc string
> 	//replace with the attributed string

You might want to take a look at how the attachments are being created.  Each one needs to have a suitable fileWrapper containing the image file you want written out, or they cannot be written to disk.  Note that the display of the attachments is controlled by the NSTextAttachmentCell, which can work fine even if there is no file representation for the image.  You don't mention what image file format you are using.

Douglas Davidson

_______________________________________________

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

References: 
 >Losing attachments when saving rtfd (From: Matthew Weinstein <email@hidden>)

  • Prev by Date: Re: WWDC
  • Next by Date: Re: WWDC
  • Previous by thread: Re: Losing attachments when saving rtfd
  • Next by thread: Canceling a NSURLConnection
  • Index(es):
    • Date
    • Thread