• 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
NSData & NSAttributedString & value transformation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSData & NSAttributedString & value transformation


  • Subject: NSData & NSAttributedString & value transformation
  • From: Timothy Reaves <email@hidden>
  • Date: Mon, 26 Dec 2005 00:20:29 -0500

Hello all. I have a text box in my UI that creates NSAttributedString objects, and stored them in a attribute of type NSData. I use the value transformer to do this, and it works well.

Now I'm wanting to store the NSData object in an XML file. So I use the value transformer again to convert the NSData to an NSString. I believe this is also correctly implemented. The data that gets stored in the XML file is identical to what gets stored in a core data xml store file as well. I check this in the process of troubleshooting my problem.

The problem is that when I read back in the XML file, and transform the NSString to an NSData, I get an exception logged

Cannot create NSAttributedString from object This is the text that should display in the text area.{
NSFont = "ArialMT 13.00 pt. P [] (0x049f13a0) fobj=0x04e4ecb0, spc=3.61";
NSParagraphStyle = Alignment 4, LineSpacing 0, ParagraphSpacing 0, ParagraphSpacingBefore 0, HeadIndent 0, TailIndent 0, FirstLineHeadIndent 0, LineHeight 0/0, LineHeightMultiple 0, LineBreakMode 0, Tabs (28L, 56L, 84L, 112L, 140L, 168L, 196L, 224L, 252L, 280L, 308L, 336L), DefaultTabInterval 0, Blocks (null), Lists (null), BaseWritingDirection -1, HyphenationFactor 0, TighteningFactor 0.05, HeaderLevel 0;
} of class NSCFString

Well, that looks correct to me. I can see my actual text in there, as well as the formatting instructions. It just can't seem to create the NSAttributedString.


Any ideas as to what I might be doing incorrectly? As I said, what gets saved in my XML document is exactly the same as a core data XML file; it's just the reverse process that gets screw up some how.

Thanks.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Prev by Date: What circumstances does a bundle fail to load?
  • Next by Date: customizing save behavior in doc based apps
  • Previous by thread: Re: What circumstances does a bundle fail to load?
  • Next by thread: customizing save behavior in doc based apps
  • Index(es):
    • Date
    • Thread