Save file using mac application - file extension

I have a little question, I'm trying to understand how to save a file with Cocoa for a Mac application, I understand that I can save it using the save panel.

Here is a great example: Saving files in cocoa

Now my question is: is there a way to save a document (plst file) with my extension (e.g.. * .Fun, * .xxx, * .myextension, ecc ...)? I want to be able to open my application when the user double-clicks the file.

+7
source share
1 answer

Define accepted document types in your plist application; something like that:

Make "yourExtension" what you want the extension to be without a period.

But once you have done this, it's up to you how to load them upon opening. One that includes NSDocument and friends. See how the document-based application works. Here are some Apple documentation on this .

If you want to see it in action, check out the TextEdit source in / Developer / Examples. In addition, if you do not mind migrating the progress made, Xcode has a template for a document-based application (create a new project and select the "Create a document-based application" check box.)

+5
source

All Articles