tags:

views:

113

answers:

2

What's the right way to go about saving data like Pages, Numbers and other OSX applications do? That is, it looks like a file to the user, but is in fact a directory (a bundle?) containing a variety of stuff. I have some fairly complex data that I'd like to store in the same way; in particular, some sensor data that needs to be associated with video files.

+3  A: 

The Apple official docs on the topic are probably a good starting point.

From the Pages Info.plist file:

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeExtensions</key>
        <array>
            <string>pages</string>
        </array>
        [...]
        <key>LSTypeIsPackage</key>
        <true/>
        [...]
    </dict>
</array>

seem to be what does the trick.

Sii
Ahh, that's it! A remarkably difficult topic to search upon without knowing what it's called!
Dan
+1  A: 

It also looks like NSFileWrapper may be part of the answer: Document-Based Applications Overview FAQ.

Dan