On May 30, 2010, at 5:15 PM, julius wrote:

> John hi
> On 30 May 2010, at 19:47, John Joyce wrote:
> 
>> That's not how these constants work.
>> These are intended to be constants that return the correct type for the 
>> current build of the system.
>> This protects your software from a change in the actual UTI of a common type.
>> 
> 
> I can understand the use of constants to such a purpose. 
> Hence for instance my ability to write a file as NSRTFTextDocumentType when 
> in the Save panel I have opted to save it as com.apple.rtfd or as a document 
> having no UTI at all.
> 
> If I read a document for which I have declared no UTI then the ofType 
> parameter in the readFromData:ofType:error: displays the Name I have used to 
> describe that document type. On the other hand if I have used a UTI then it 
> is the UTI that is passed as the ofType parameter.
> 
> So if I have this correctly, in the case of files that will only ever be read 
> by my application it really does not matter what extension or UTI I give them 
> since it is the responsibility of my code to make sense of them. However, if 
> I want to  write files that other applications can read I have not only to 
> provide the correct format but also the correct extension or UTI . Is it 
> therefore the case that when writing files to be read by other applications I 
> need not only write using the correct NSDocumentTypeDocumentAttribute but 
> also provide the correct UTI (or extension)? If so then surely I need to have 
> an idea of which UTI's (if any) go with a given 
> NSDocumentTypeDocumentAttribute?
> 
> Thanks
> Julius
> 
> 
> http://juliuspaintings.co.uk
> 
Your application declares the types of files it can read and/or edit. 
It declares these types by UTI.

If an application declares that it can read files of type x, then you can 
definitely open files of type x with that application.

Not all UTIs are built in the OS. 
They're "registered" with the OS.
The OS does not know about many (most?) file types out of the box.

The OS can attempt to identify a file's type.
It doesn't always know 100% what app should or could open a file or edit it.
It will then give you a choice of "Recommended applications", that is, apps 
that are declared to read or edit a file of the UTI that the OS thinks this 
file might be. The OS does allow the user to choose from "All Applications" 
also, because the OS cannot realistically know about all file types ahead of 
time.

This data is covered, but you may want to explore further the docs, a few books 
on cocoa, and sample apps from apple.
Look at how they handle this.
Ideally, look at open source or sample apps that handle similar file types to 
yours.

_______________________________________________

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

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

Reply via email to