On 31 May 2010, at 01:42, John Joyce wrote:

> 
> 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.

That is what I thought.
> 
> 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.
That too is my understanding
> 
> 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.
Which is why (I think I correctly assume) one's program has to make decisions 
regarding how to handle incoming or outgoing file data on the basis of the 
ofType: parameter.
> 
> 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.
Yes. But I have!!! 
And am still none the wiser as to which type goes with which 
NSDocumentTypeDocumentAttribute.
For instance I have been been studying TextEdit for a while now and seeing how 
it maps the files it reads and writes to the UTI's and other indications of 
type but it does not tell me where I can find the indicators for the mappings 
it does not use or the range of what is actually encompassed by the mappings 
that it does use. 

I merely wondered where to get information on the mapping between 
NSDocumentTypeDocumentAttribute(s) and the UTI's or other indicators of type.
I guess the reason I'm having difficulties is that there ain't no such 
documentation?

There's only 9 of these mappings of which I think I know a couple of the 
corresponding types but the rest are a mystery.
Could you or someone else to just fill in the remaining 7 blanks for me?
Also, since when I look at how spotlight types various files I can see that  a 
file may be described by more than one UTI, 
Similarly the UTI reference talks of base types which implies the existence of 
a hierarchy (or is it a looser organisation?). Where is this actual, not 
theoretical, hierarchy documented?

NSPlainTextDocumentType - ?
NSRTFTextDocumentType - public.rtf - is this right? It looks right but I have 
no means other than experiential of finding out
NSRTFDTextDocumentType - com.apple.rtfd - ditto here.
NSMacSimpleTextDocumentType - ?
NSHTMLTextDocumentType - ?
NSDocFormatTextDocumentType - ?
NSWordMLTextDocumentType - ?
NSOfficeOpenXMLTextDocumentType - ?
NSOpenDocumentTextDocumentType; - ?


------------------------------------------------------
http://juliuspaintings.co.uk


_______________________________________________

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