documentClassForType:typeName is dynamic type instead of my declared type

2015-02-03 Thread Steve Mills
I'm setting up my document types and exported UTIs in my Info.plist. (The main 
type is a package, if that matters.) The Save dialog correctly shows my type at 
the top of the Type popup, it saves it with the correct extension, and Finder 
shows that it's a package, not a folder. But when I drag  drop the file to my 
app, the type given to documentClassForType: is dyn.ah62d4qmuhk2x44pdra instead 
of my UTI. I've tried the usual crap, like cleaning the build folder, building, 
and logging out. Ideas? My plist entries are below.

I also tried adding the same type as an imported UTI. Some examples show the 
extension and description/name in both CFBundleDocumentTypes and 
UTExportedTypeDeclarations, while others show it only in the 
UTExportedTypeDeclarations. Which is correct?

No Mac project would be complete if I didn't run into Info.plist problems at 
some point.

keyCFBundleDocumentTypes/key
array
dict
keyCFBundleTypeExtensions/key
array
stringchest/string
/array
keyCFBundleTypeIconFile/key
stringDocIcon/string
keyCFBundleTypeName/key
stringImage Chest Catalog/string
keyCFBundleTypeRole/key
stringEditor/string
keyLSItemContentTypes/key
array

stringcom.armpitstudios.$(PRODUCT_NAME:rfc1034identifier).chest/string
/array
keyLSTypeIsPackage/key
integer1/integer
keyNSDocumentClass/key
stringDocument/string
/dict
/array

keyUTExportedTypeDeclarations/key
array
dict
keyUTTypeConformsTo/key
array
stringpublic.data/string
/array
keyUTTypeDescription/key
stringImage Chest Catalog/string
keyUTTypeIconFile/key
stringDocIcon/string
keyUTTypeIdentifier/key

stringcom.armpitstudios.$(PRODUCT_NAME:rfc1034identifier).chest/string
keyUTTypeTagSpecification/key
dict
keypublic.filename-extension/key
array
stringchest/string
/array
/dict
/dict
/array

--
Steve Mills
Drummer, Mac geek


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: documentClassForType:typeName is dynamic type instead of my declared type

2015-02-03 Thread Quincey Morris
On Feb 3, 2015, at 12:07 , Steve Mills sjmi...@mac.com wrote:
 
 (The main type is a package, if that matters.) The Save dialog correctly 
 shows my type at the top of the Type popup, it saves it with the correct 
 extension, and Finder shows that it's a package, not a folder. But when I 
 drag  drop the file to my app, the type given to documentClassForType: is 
 dyn.ah62d4qmuhk2x44pdra instead of my UTI.

   keyUTTypeConformsTo/key
   array
   stringpublic.data/string
   /array

The ‘dyn’ UTI means that something (presumably a .chest extension in this case) 
was converted to a UTI, but that no known UTI was capable of “claiming” it, so 
a new temporary one was created.

My guess is that it’s for one of two reasons:

1. Because this is a package, the UTI must be declared to conform to 
com.apple.package, not public.data. (According to 
https://developer.apple.com/library/mac/documentation/General/Reference/InfoPlistKeyReference/Introduction/Introduction.html
 
https://developer.apple.com/library/mac/documentation/General/Reference/InfoPlistKeyReference/Introduction/Introduction.html,
 the “LMTypeIsPackage” key is ignored when a ”LSItemContentTypes” key is 
present. The list of sub-keys under ‘CFBundleDocumentTypes’, also says which 
other keys are ignored in this case, such as CFBundleTypeExtensions.)

So, right extension, wrong structure, and LS couldn’t figure out what you meant.

There’s a document somewhere that says how to configure a file type properly as 
a package and a non-package, but I can’t find it now. Non-packages should 
conform to public.content *and* public.data, IIRC, FWIW.

2. Because there’s an older, out of date app bundle on your system somewhere, 
and Launch Services is using that as its definitive source of information.



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: documentClassForType:typeName is dynamic type instead of my declared type

2015-02-03 Thread Steve Mills
On Feb 3, 2015, at 14:49:43, Quincey Morris 
quinceymor...@rivergatesoftware.com wrote:
 
 1. Because this is a package, the UTI must be declared to conform to 
 com.apple.package, not public.data.

Bingo! Thanks so much for that, and I've deleted the other non-used keys.

--
Steve Mills
Drummer, Mac geek


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com