• 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: Best Practices for Associating a File Extension With a File in XCode 4?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Best Practices for Associating a File Extension With a File in XCode 4?


  • Subject: Re: Best Practices for Associating a File Extension With a File in XCode 4?
  • From: Vik Rubenfeld <email@hidden>
  • Date: Sun, 04 Sep 2011 17:56:53 -0700

The suggestion that I create a new document-based Cocoa app and use it for a model worked!

I had previously tried something a bit similar by looking at some of the Apple demo code, specifically DemoMonkey, without success.

I have posted a screenshot of the successfully completed app settings here:

http://tinyurl.com/3wrfej5

Here's what worked:

Under Project Settings->Targets->Info, I deleted all previous entries under Document Types.
I clicked the Add + button on the lower right and selected "Add Document Type"
For the new document type, I entered descriptive text in the name field; specified the desired class in the the class field; and entered the desired extension in the extension field.

I compiled and ran. Interestingly, a window of the specified class was immediately created. This was not the desired behavior for my app. (My app supports a number of different document types, each of which needs its own file extension.) I went back to Project Settings and created a new Document Type, for another one of my classes, which should have a window created upon program launch. I made that document type the first in the list.

I then compiled and ran the app. Using a menu command, I created a window of type "QuickLookOutputDocument" and saved it.  It received the correct file extension.

Thanks very much in advance to all for your help on this!


On Sep 4, 2011, at 12:43 PM, Quincey Morris wrote:

> On Sep 4, 2011, at 09:06 , Vik Rubenfeld wrote:
>
>> I created a document type XML; assigned it to my document class; and filled in a file extension for it.
>>
>> I cleaned my XCode project, recompiled and ran. Still no file extension is appended to the document when I save it.  Are there or more final steps I am leaving out?
>
> Why do you have 4 document types? It looks like you have too much stuff in there.
>
> IIRC, if you have multiple types, you want your default type to be the first one. The document type gets chosen by default when a new document is created. You can choose a different one by using NSDocument/NSDocumentController methods, but it's far simpler to let the default be the correct one.
>
> The document type is what's displayed in Finder Get Info windows, so it usually is more specific than just "XML" and isn't necessarily about the data representation. It's usual to have the application name in there, if it's a app-specific document. For example, my ".pages" documents show up in the Finder as "Pages Publication".
>
> Your UTI ("Identifier") is invalid. There's a specific set of rules for naming UTIs, and for custom UTIs you either need to export or import the definition too. Probably, at this stage, you should just not specify a UTI at all.
>
> I'd suggest you create yourself a new document-based Cocoa application from the Xcode template, and use that as a model for setting up your document types.
>
>

_______________________________________________

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: 
 >Re: Best Practices for Associating a File Extension With a File in XCode 4? (From: Lee Ann Rucker <email@hidden>)
 >Re: Best Practices for Associating a File Extension With a File in XCode 4? (From: Vik Rubenfeld <email@hidden>)
 >Re: Best Practices for Associating a File Extension With a File in XCode 4? (From: Quincey Morris <email@hidden>)
 >Re: Best Practices for Associating a File Extension With a File in XCode 4? (From: Vik Rubenfeld <email@hidden>)
 >Re: Best Practices for Associating a File Extension With a File in XCode 4? (From: Kyle Sluder <email@hidden>)
 >Re: Best Practices for Associating a File Extension With a File in XCode 4? (From: Vik Rubenfeld <email@hidden>)
 >Re: Best Practices for Associating a File Extension With a File in XCode 4? (From: Quincey Morris <email@hidden>)
 >Re: Best Practices for Associating a File Extension With a File in XCode 4? (From: Vik Rubenfeld <email@hidden>)
 >Re: Best Practices for Associating a File Extension With a File in XCode 4? (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Best Practices for Associating a File Extension With a File in XCode 4?
  • Next by Date: Window closes on its own
  • Previous by thread: Re: Best Practices for Associating a File Extension With a File in XCode 4?
  • Next by thread: typedef show up as existing type while introspecting, want to show defined data type
  • Index(es):
    • Date
    • Thread