Saving a variable in rich text format

I have a window with a text field in it. I have the application periodically save the document, but when I quit and relaunch the application the text within the text field is either in plain text or totally in bold or italics, but never mixed (like it was before I quit and relaunched).

What’s up with that?

“Text fields” do not support rich text/ attributed strings. Can I assume that you mean text view?

By what mechanism? Are you using the document-based app commands for saving data, or are you just getting the text string from the text view and using a basic write to file handler? The only way that your formatting will be remembered is if you use one of the document data handlers or use a cocoa method to write the data to a file. Simply reading the string value of the view and writing it to file does not retain it’s formatting.