Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

UTI Question



Hi,

I'd like to convert MIME types for a number of image formats, obtained
from a third-party library, to Uniform Type Identifiers that I can safely
store persistently, and expect to map back to a reasonable MIME type
(or file extension) even in future versions of the OS.

To this purpose, I'm calling UTTypeCreatePreferredIdentifierForTag like
this:

uti = (NSString*) UTTypeCreatePreferredIdentifierForTag
    (kUTTagClassMIMEType,
     (CFStringRef)mimeType,
     (CFStringRef) @"public.image");

For common MIME types like "image/jpeg" and "image/png", this
works as expected, returning "public.jpeg" and "public.png".

Many MIME types, though, either unofficial (e.g., "image/x-canon-crw")
or officially registered but unsupported by the default UTI tables
(e.g., "image/vnd.adobe.photoshop") map to dynamic UTIs, and the
dynamic UTI encoding is subject to change, so I can't safely store
it persistently (can I?).

I thought I could avoid generating dynamic UTIs by including an
exhaustive UTImportedTypeDeclarations list in my Info.plist,
with mappings such as:

    image/x-canon-crw               com.canon.crw-raw-image
    image/vnd.adobe.photoshop       com.adobe.photoshop-image

but the mappings don't seem to have any effects on the results
of UTTypeCreatePreferredIdentifierForTag().  lsregister reveals
that my mappings *have* been recorded in the Launch Services
database, but somehow marked as "inactive", whatever that means.
Here's a portion of the ouput of lsregister -dump:

        type    id:            2753363968
                uti:           com.canon.crw-raw-image
                description:   Canon raw image
                flags:         imported  inactive  
                icon:          
                conforms to:   public.image, public.data
                tags:          .crw, 'CRW ', image/x-canon-crw

I found that if I include a list of *exported* type declarations
in my Info.plist, the mappings are "activated", and
UTTypeCreatePreferredIdentifierForTag() works as expected,
but I'm not sure using exported is the right thing.

Any suggestions?


                                    -- marco

-- 
It's not the data universe only, it's human conversation.
They want to turn it into a one-way flow that they have entirely
monetized. I look at the collective human mind as a kind of
ecosystem. They want to clear cut it. They want to go into the
rainforest of human thought and mow the thing down.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.