PDA

View Full Version : generate .dict file for KVC




medasmx
Oct 11, 2009, 08:24 AM
I am working on a simple version of dragndropoutlineview, the apple sample code that comes with XCode. The first step has been to create the outline view. In this example they use a dict file (to generate the outline view), with KVC.

My problem has been that I can't create the dict file myself. I tried to open an empty file then paste the XML code from the apple sample, with the idea that I could edit and simplify it. The problem is that when you save it as a dict file then it goes to a non-text format, so I can't paste the code. When you don't save it as a dict file then the file has no extension, so I can't really reference it in my code. I guess I am just asking how to create a basic text file that can be saved with a .dict extension, to use in KVC. Thanks for any help.



medasmx
Oct 11, 2009, 08:41 AM
I just re-saved it with an .dict extension. However, it then converted it to a non-text format. How do you convert back to the format of a text file?

Adam

chown33
Oct 11, 2009, 01:28 PM
I'm not sure what you mean by "a non-text format", but my guess is that it's being saved as RTF or some other "rich text" format.

Assuming this is what's happening, try this:

1. Open the file in TextEdit.
2. Choose Make Plain Text from the Format menu.
3. Choose Save As from the File menu.
4. Enter "SomeName.dict" in the Save As box.
5. Choose Unicode (UTF-8) in the Plain Text Encoding popup.
6. Uncheck the Hide Extension checkbox.
7. Click the Save button.

To edit the file in the future, simply drag and drop it on top of TextEdit. It should be able to figure out the encoding by itself, so you can just do Save in future edits, rather than Save As.

FWIW, there is a TextEdit preference to open new documents as Plain text rather than Rich text. You may want the Plain text option if you're creating a lot of plain text files.


If the above doesn't solve the problem, then you'll have to provide more details about the non-text format. Without knowing your experience or skills at the command-line, the simplest approach is probably to compress the problematic file and attach it to a post.

If you have command-line skills, then posting the first few lines of output from this command would probably be enough:

hexdump -C /path/to/the/ProblematicFile.dict