Let the user choose what type of document to open

Posted by Koning Baard XIV on Stack Overflow See other posts from Stack Overflow or by Koning Baard XIV
Published on 2010-03-22T15:06:29Z Indexed on 2010/03/22 15:11 UTC
Read the original article Hit count: 362

Filed under:
|
|

I'm creating an NSDocument application, with two document types: Website and Webservice. This is in my Info.plist:

<key>CFBundleDocumentTypes</key>
 <array>
  <dict>
   <key>CFBundleTypeName</key>
   <string>Website</string>
   <key>CFBundleTypeExtensions</key>
   <array>
    <string>website</string>
   </array>
   <key>LSTypeIsPackage</key>
   <true/>
   <key>CFBundleTypeRole</key>
   <string>Editor</string>
   <key>LSHandlerRank</key>
   <string>Default</string>
   <key>NSDocumentClass</key>
   <string>AWWebSite</string>
  </dict>
  <dict>
   <key>CFBundleTypeName</key>
   <string>Web Service</string>
   <key>CFBundleTypeExtensions</key>
   <array>
    <string>webservice</string>
   </array>
   <key>LSTypeIsPackage</key>
   <true/>
   <key>CFBundleTypeRole</key>
   <string>Editor</string>
   <key>LSHandlerRank</key>
   <string>Default</string>
   <key>NSDocumentClass</key>
   <string>AWWebService</string>
  </dict>
 </array>

Now, whenever the user opens the application, selects the 'New' item from the menubar, or clicks the Dock icon while there are no open windows, I want to show a window with two options, each for one of the document types. Can anyone help me with this? Thanks

© Stack Overflow or respective owner

Related posts about nsdocument

Related posts about cocoa