• 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
Adding UTI to document type causes NSDocumentController Misbehavior
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Adding UTI to document type causes NSDocumentController Misbehavior


  • Subject: Adding UTI to document type causes NSDocumentController Misbehavior
  • From: Jerry Krinock <email@hidden>
  • Date: Mon, 30 Mar 2009 13:38:19 -0700

The other day I was writing an AppleScript and noticed that AppleScript's 'choose file' command has a parameter 'of type' which requires a UTI. Since I'd like to be able to use this parameter in AppleScripts that choose my app's documents, I read up on UTI [1]. It all seems very simple, including the fact that "if a suitable UTI does not exist, you can create your own".

Since my document type is proprietary, I opened the editor on my project's app target and, in the Properties tab, in the line for my app's single document type, I saw that the UTI was blank. So I changed it to com.MyCompanyBlah.Blah.

The results of this:

1. In my app's Info.plist, in the CFBundleDocumentTypes, in the single array for my single document type, there was added a key LSItemContentTypes, an array containing a single string, com.MyCompanyBlah.Blah. Per documentation, this is expected.

2. Before adding the UTI, -[NSDocumentController defaultType] returned the "Name" of my single document type. After, it returns its UTI. This is odd -- seems like we've got some wires crossed here. Indeed...

3. During running of -[NSDocumentController openUntitledDocumentAndDisplay:error], for example, to create a new document, it raises an exception:
*** -[NSPathStore2 stringByAppendingPathExtension:]: nil argument


Remove the UTI from the Target's Properties and now new documents can now be created again.

Why the strange reactions from NSDocumentController? Is this one of those situations where I need to kick Launch Services in the pants or something like that?

Sincerely,

Jerry Krinock


[1] http://developer.apple.com/macosx/uniformtypeidentifiers.html _______________________________________________

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


  • Prev by Date: Launching a preference pane from inside a Cocoa app
  • Next by Date: Re: Launching a preference pane from inside a Cocoa app
  • Previous by thread: Re: Launching a preference pane from inside a Cocoa app
  • Next by thread: How can I draw an election map?
  • Index(es):
    • Date
    • Thread