Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How can I support reading one type and (internally) automatically converting to another?

0
Posted

How can I support reading one type and (internally) automatically converting to another?

0

Sometimes you might understand how to read a type, but not how to write it, and yet, when you read documents of that type, you want to automatically convert them to another type that you can write. An example of this would be an application that can read documents from an older version (or from a competing product). It might want to read in the old documents and automatically convert them to the new native format. The first step is to add the old type as a read-only type (see “How can I support read-only types?”).By doing this, you will be able to open the old files, but they will come up as untitled files. If you want to automatically convert them to be saved as your new type, you can override the readFrom… methods in your NSDocument subclass to call super and then reset the filename and type afterwards. You should use setFileType: and setFileName: to set an appropriate type and name for the new document.For the filename you might want to make sure to strip the file extension of the

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123