• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Upgrading NSDocument format, best practice
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Upgrading NSDocument format, best practice (From: Markus Spoettl <email@hidden>)
 >Re: Upgrading NSDocument format, best practice (From: "I. Savant" <email@hidden>)
 >Re: Upgrading NSDocument format, best practice (From: "I. Savant" <email@hidden>)

  • Prev by Date: Re: Debug-level messages don't appear in Console even after asl_set_filter()
  • Next by Date: How to create subentity object inheriting from superentity object in core data
  • Previous by thread: Re: Upgrading NSDocument format, best practice
  • Next by thread: Re: Upgrading NSDocument format, best practice
  • Index(es):
    • Date
    • Thread