Re: Upgrading NSDocument format, best practice
Re: Upgrading NSDocument format, best practice
- Subject: Re: Upgrading NSDocument format, best practice
- From: Markus Spoettl <email@hidden>
- Date: Wed, 16 Sep 2009 19:49:29 +0200
On Sep 16, 2009, at 4:21 PM, I. Savant wrote:
Wow ... let me decipher this paragraph, which I obviously didn't
proofread. :-D
When defining your document types (in the Info.plist file), you can
designate a type as having an "Editor" role. This is typical.
Unchecking this makes it a type your application will only read, but
not save. If you uncheck the editor role for your old type, then add
a new type that has the editor role, a save action on a document of
the old type should trigger the Save As dialog, with the new format
(as an editor role) selected.
Hmm, I'm having unexpected problems getting this to work. It doesn't
trigger the save-as behavior as expected, instead it just saves under
the old extension - using the new format.
I defined a second document type as a copy of the old, change the file
extension (adding "2" at the end), even changed the document class of
the old one to a sub-class of the original document class (because I
suspected they can't be the same - turned out that wasn't it) and
changed the old document's role to "Viewer".
Below is the relevant portion of my Info.plist
Any ideas?
I'm working with Xcode 3.2, my base SDK and deployment target is 10.5
Regards
Markus
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>myApp</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>myApp-document-icon.icns</string>
<key>CFBundleTypeName</key>
<string>myApp Document</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>????</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>NSDocumentClass</key>
<string>MyAppLegacyDocument</string>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>myApp2</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>myApp-document-icon.icns</string>
<key>CFBundleTypeName</key>
<string>myApp 2 Document</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>????</string>
</array>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>NSDocumentClass</key>
<string>MyAppDocument</string>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
--
__________________________________________
Markus Spoettl
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden