Skip navigation.
 
mlLeopard: fileExtensionsFromType: deprecation breaks saving with extension
FROM : Fritz Anderson
DATE : Fri Nov 09 21:44:24 2007

My problem seems to entangle Cocoa and Xcode, but I'm trying this list 
first.

I am running Xcode 3.0 on Leopard.

When I try to save my application's document, the document does not 
get the proper extension. An extensive diagnostic (below) appears in 
the debugger console. The document, including type, UTI, and 
extension, is declared properly in the Properties tab of the Target 
Info. (Or at least, properly as of Tiger, and to the full extent that 
window permits.)

I also cannot open old documents that had the correct extension. (Yes, 
saving worked before, and I can't determine what went wrong.)

My question, in brief, is: How do I get the behavior I believe I am 
specifying?

   — F


The document class implements dataOfType:error: .

Here is the doc-type list from my application's Info.plist file:

==============
    <key>CFBundleDocumentTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeExtensions</key>
            <array>
                <string>myappfile</string>
            </array>
            <key>CFBundleTypeIconFile</key>
            <string></string>
            <key>CFBundleTypeName</key>
            <string>MyApp Data File</string>
            <key>CFBundleTypeOSTypes</key>
            <array>
                <string>mypF</string>
            </array>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>LSItemContentTypes</key>
            <array>
                <string>org.manoverboard.myapp.file</string>
            </array>
            <key>NSDocumentClass</key>
            <string>MyDocument</string>
        </dict>
    </array>
==============

When I try to save my application's document, the console fills with

==============
-[NSDocumentController fileExtensionsFromType:] is deprecated, and 
does not work when passed a uniform type identifier (UTI). If the 
application didn't invoke it directly then the problem is probably 
that some other NSDocument or NSDocumentController method is getting 
confused by a UTI that's not actually declared anywhere. Maybe it 
should be declared in the UTExportedTypeDeclarations section of this 
app's Info.plist but is not. The alleged UTI in question is 
"org.manoverboard.myapp.file".
==============

So I have "a UTI that's not actually declared anywhere?" I declare it 
as a document attribute in Info.plist, and had not thought it 
necessary to declare it elsewhere.

My UTI string appears nowhere but in the document declaration in 
Info.plist. I don't send fileExtensionsFromType: .

The message says I should declare my UTI in 
UTExportedTypeDeclarations. But Xcode does not provide a UI for 
creating or editing that list.

I'm using this project as a teaching example. Please tell me I don't 
have to tell my pupils to hand-edit Info.plist.

I am out of ideas.

How can I avoid this diagnostic, and get the extension declared for 
this document type (and UTI)?

Related mailsAuthorDate
mlLeopard: fileExtensionsFromType: deprecation breaks saving with extension Fritz Anderson Nov 9, 21:44
mlRe: Leopard: fileExtensionsFromType: deprecation breaks saving with extension Adam R. Maxwell Nov 9, 22:06
mlRe: Leopard: fileExtensionsFromType: deprecation breaks saving with extension listposter Nov 10, 04:55
mlRe: Leopard: fileExtensionsFromType: deprecation breaks saving with extension Adam R. Maxwell Nov 10, 05:33
mlRe: Leopard: fileExtensionsFromType: deprecation breaks saving with extension Andre Nov 10, 05:39