Re: Problem getting import UTI recognised
Re: Problem getting import UTI recognised
- Subject: Re: Problem getting import UTI recognised
- From: Graham Cox <email@hidden>
- Date: Thu, 16 Oct 2014 22:07:27 +1100
On 16 Oct 2014, at 7:04 pm, Graham Cox <email@hidden> wrote:
> It acts exactly the same.
>
> I subclassed NSDocumentController so I can intercept and log some of the internals, and the file types being passed to -beginOpenPanel:forTypes:completionHandler: are correct - all of the document types I declare are there. But the resulting Open panel still greys out my native type. I don't know if this open panel calls back into the document controller as a delegate, but there seem to be no other public methods that I can override to check what's going on - it seems possible that the open panel might be talking directly to launch services outside of the app, so it can still ignore some of the local info even though that seems all in order.
I must be doing something wrong.
I made a clean build of my app, moved it to another machine and it does exactly the same thing - can't recognise files of its own type.
I've cut down my UTI and document types to a minimum, with a single export for my private native file type, and no imports. I declare 3 document types which include some types written by another app (including plain text). Since I have this other app installed, these files are registered as belonging to it, but can be opened by my app. If I don't declare any UTIs at all I get an error logged from NSDocumentController.
Overriding -[NSDocumentController typeForContentsOfURL:error:], I log the UTI that is returned by super's implementation (this is having forced the app to open this file type by setting the "Open With..." mapping in Finder and double-clicking the file - it still isn't available in the Open dialog, nor draggable on my app's icon).
2014-10-16 21:42:48.896 Crucible 2[380:3307] type = dyn.ah62d4rv4ge80g8dyq2, URL = file:///Users/grahamcox/Documents/Test Files/TestFile2.cxtf
It is a dyn.<blahblah> type, which indicates that the UTI for the given file extension is unknown. So this is the puzzle - why, having exported a UTI for that very extension (.cxtf), is it still returning unknown, even after rebuilding the database, safe rebooting, etc. My export declaration must be incorrect, but AFAICS it looks fine:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.content</string>
</array>
<key>UTTypeDescription</key>
<string>Crucible File</string>
<key>UTTypeIconFile</key>
<string>crucibledoc</string>
<key>UTTypeIdentifier</key>
<string>net.apptree.crucible.newcrossfile</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>com.apple.ostype</key>
<array>
<string>CXTF</string>
</array>
<key>public.filename-extension</key>
<array>
<string>cxtf</string>
</array>
</dict>
</dict>
</array>
</plist>
If I force the above NSDocumentController method to return the expected UTI, it does go ahead and opens the file properly. However, this is not a fix, because it only allows the file to be opened by forcing it open with the app and double-clicking, not in the Open dialog.
Still stumped, but maybe somone can spot an issue with the UTI export?
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden