On Jan 30, 2013, at 1:27 PM, Steve Mills <smi...@makemusic.com> wrote:

> On Jan 30, 2013, at 15:15:32, Kevin Perry <kpe...@apple.com>
> wrote:
> 
>> On Jan 30, 2013, at 12:32 PM, Steve Mills <smi...@makemusic.com> wrote:
>> 
>>> I finally got this all figured out. This is a mess. It's goofy that Apple 
>>> decided to send the localized type name strings here
>> 
>> I’m not following you here. What is sending localized type names where?
> 
> NSDocument methods:
> 
> -(BOOL) writeToURL:(NSURL*)absoluteURL ofType:(NSString*)typeName 
> error:(NSError**)outError
> 
> passes the type in typeName.
> 
> -(NSArray*) writableTypesForSaveOperation:(NSSaveOperationType)saveOperation
> 
> expects an array of type name strings.
> 
> -(NSString*) fileTypeFromLastRunSavePanel
> 
> returns the type name string. Etc.

I admit I’m a little confused by your claims. All of NSDocument should 
definitely be able to use UTIs in every modern API that refers to types.

For example, here’s the result of the default NSDocument implementation of 
-writeableTypesForSaveOperation:, for TextEdit:

$0 = 0x0000000106a19150 <__NSArrayM 0x106a19150>(
public.rtf,
com.apple.rtfd,
public.html,
com.apple.webarchive,
org.oasis-open.opendocument.text,
org.openxmlformats.wordprocessingml.document,
com.microsoft.word.wordml,
com.microsoft.word.doc,
public.text,
public.plain-text
)

(TextEdit does override this method, but it itself uses [[self class] 
writableTypes], which also returns an array of UTIs.)

Do you have a mix of old-style type names and UTIs in your Info.plist?

> 
>> The way NSSavePanel is designed, it is completely agnostic of the accessory 
>> view inserted into it, even one owned by NSDocument. It has no idea how to 
>> change the contents of the accessory view based on what you pass to 
>> -setAllowedFileTypes:—there may not even be a document type popup there at 
>> all.
> 
> Right, which means NSDocument should've had its various methods that deal 
> with its accessory panel use something more viable like extensions and/or 
> UTIs, which is exactly what NSSavePanel uses to deal with file types.
> 
>> If you want to customize what types NSDocument shows in its default 
>> accessory view, then overriding -writableTypesForSaveOperation: is exactly 
>> the right thing to do. Sorry for the trouble you had in discovering 
>> that—would you like to file a documentation bug with a suggested improvement?
> 
> I just might do that. Although NSDocument has already gone through big 
> changes in the way it handles saving documents, I wonder how likely they'd be 
> to change it again.
> 
> --
> Steve Mills
> office: 952-818-3871
> home: 952-401-6255
> cell: 612-803-6157
> 
> 
> 
> 
> _______________________________________________
> 
> 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/kperry%40apple.com
> 
> This email sent to kpe...@apple.com


_______________________________________________

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

Reply via email to