Reputation: 9392
I'm trying to create a document-based application but the problem is that I don't know how to edit the Info.plist file in order to let the application open certain types of files. I've looked through the apple's "Document-Based Applications Overview" guide to help, but to no avail.
I want my application to open .txt files and .rtf files. My interface only has a simple text view.
Please help. Thanks
Edit:
Every time I compile my code, my app just loads, but it shows an alert panel saying "No Document could be created". And in the log it just says "The public.rtf type doesn't map to any NSDocumentClass."
As for my properties tab, I have "Text Document" for my CFBundleTypeName and "public.rtf" for my LSItemContentTypes.
Upvotes: 1
Views: 8889
Reputation: 13833
in info.plist in CFBundleDocumentTypes Key add CFBundleTypeName and set its values as extension for example to add support for word file add DOC as its value
There is nice article about it
Upvotes: 1
Reputation:
The Document-Based Applications Overview has a section called Storing Document Types Information in the Application's Property List. In that section, they explain how to edit Info.plist so that it lists supported document types. Their example is TextEdit, which opens RTF and plain text files much like what you want.
To open the window depicted in Figure 1, double click your target in the project folder tree (under the Targets section) and select the Properties tab.
Upvotes: 1
Reputation: 25244
simply click it in xcode. you also have the option to show it in source code style (xml-like). for that right.click in xcode the plist file -> "open as" -> "source code file" (or something like that".
Upvotes: 3