DaveS
1 October 2022 00:05
1
I am trying to implement a SaveDialog (with filetypes) like this
If I use “standard” extenstions it works just fine… .
But if I use “custom ones” I get a strange value “dyn.lsdkfjafajf”
Spent hours trying to figure it out , but all the examples are convoluted and complex
Anyone know how to create a SIMPLE UTI for Swift???
Don’t need icons or that… just the Extension and a Description
imported and exported doc types
if you peek in the Info.plist fo Xojo you’ll see numerous “document types” under the key CFBundleDocumentTypes
1 Like
DaveS
1 October 2022 01:11
3
Thanks… WOW lot of data… but I think I pared it down to the 60 lines or so I need…
gotta test… [flying blind]
DaveS
1 October 2022 01:14
4
WOO HOO! it worked
there seemed to be a bunch of redundant data (and maybe it is)… but it works
<?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">
<dict>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>Rapid Studio Project</string>
<key>CFBundleTypeIconFile</key>
<string>RAPIDProject.icns</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>Rapid</string>
</array>
<key>CFBundleTypeExtensions</key>
<array>
<string>rapid2022</string>
</array>
<key>LSItemContentTypes</key>
<array>
<string>com.sisemore.rapid2022</string>
</array>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeIdentifier</key>
<string>com.sisemore.rapid2022</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>Rapid Studio project</string>
<key>UTTypeIconFile</key>
<string>RAPIDProject.icns</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>rapid2022</string>
</array>
<key>com.apple.ostype</key>
<array>
<string>rapid2022</string>
</array>
</dict>
</dict>
</array>
<key>UTImportedTypeDeclarations</key>
<array>
<dict/>
</array>
</dict>
</plist>
The docs have gotten much better since way back when I had to first implement this stuff for Cocoa apps
Back then it was guess at WTF apple even meant
Experiment
Rip apart some other apps plist
Test & try again
And I know I got some of it wrong
I think at one point I had it messed u and Xojo claimed all PDF documents or something like that
@samRowlands and I did a lot of poking prodding & commiserating about it then
IIRC, it was that UTI types were in the wrong sub. They should have been importable not exportable. I filed it as a bug with Apple, because it destroyed launchservices, Apple said “Not our problem”. I even wrote an app to clean up the mess.
Yeah I think that was it
That it was so easy for Xojo to claim every darned PDF as its own was amazing but …
It was a major embarrassment to me at the time, because my app ended up ruining launch services on my customers machines.