I'm trying to associate a custom file type and extension with my Mac Catalyst app.
On the Mac, I can get this to work by adding the following key/values to my Info.plist:
keyCFBundleDocumentTypes/key
array
dict
keyCFBundleTypeName/key
stringCustomUTI/string
keyCFBundleTypeRole/key
stringEditor/string
keyLSHandlerRank/key
stringOwner/string
keyLSItemContentTypes/key
array
stringcom.jnpdx.customuti/string
/array
/dict
/array
keyUTExportedTypeDeclarations/key
array
dict
keyUTTypeConformsTo/key
array
stringpublic.data/string
/array
keyUTTypeDescription/key
stringCustomUTI/string
keyUTTypeIcons/key
dict/
keyUTTypeIdentifier/key
stringcom.jnpdx.customuti/string
keyUTTypeTagSpecification/key
dict
keypublic.filename-extension/key
array
stringcustomuti/string
/array
keypublic.mime-type/key
array
stringcustom/uti/string
/array
/dict
/dict
/array
Once I've modified the Info.plist, sometimes I have to build my app in Xcode and then drag the product to the Applications directory before launchd will associate the file type correctly.
Once I do this, my app appears in the "Open with..." menu.
However, the steps do not appear to work for a Catalyst target. If you look at the Twitter thread that I linked to before, it suggested that the Applications folder trick worked at one point, but I have had no luck getting it to work in Big Sur (I'm running 11.2.3).
I've created a sample repo (including a couple of sample files) that you can try this out with so a tester can avoid the process of creating the targets. There is nothing here except for a "Hello, world!" app with the Info.plist set up as described above, with a macOS native target and a Catalyst target. (Remember the hint about dragging to Applications): https://github.com/jnpdx/MacNativeUTITest
Post
Replies
Boosts
Views
Activity
I'm trying to use ColorPicker in a Big Sur Catalyst app. I thought I had wrapped everything in the correct conditionals, but I'm getting a dyld crash on Catalina:
Termination Reason: DYLD, [0x4] Symbol missing
Application Specific Information:
dyld: launch, loading dependent libraries
Dyld Error Message:
Symbol not found: _$s7SwiftUI11ColorPickerVMn
Referenced from: /private/var/folders/*/Metronomics 2.app/Contents/MacOS/APP_NAME (which was built for Mac OS X 14.0)
Expected in: /System/iOSSupport/System/Library/Frameworks/SwiftUI.framework/Versions/A/SwiftUI
in /private/var/folders/*/APP_NAME2.app/Contents/MacOS/APP_NAME
Here's my conditional import:
if #available(iOS 14.0, macCatalyst 14.0, *) {
	ColorPicker("Display color", selection: colorBinding, supportsOpacity: false)
}
I tried both macCatalyst 11.0 and 14.0 for the conditional (not being sure whether the version number is referring to the macOS number or the underlying iOS number), but neither seemed to have an effect.
My deployment target is macOS 10.15.5
Goal: I would like to be able to use ColorPicker on iOS 14 and Big Sur, but the app should run on iOS 13 and Catalina.
onTapGesture seems like it's incredibly unreliable (eg clicks/taps don't always trigger the onTapGesture closures -- best case is that they're intermittent) in Big Sur for Catalyst apps. The same code runs without problem on iOS 14 and Catalina (again, with Catalyst).
Consider the following basic example:
struct ContentView: View {
@State private var greenOn = false
@State private var blueOn = false
var body: some View {
HStack {
Rectangle()
.fill(Color.green)
.opacity(greenOn ? 1.0 : 0.5)
.frame(width: 100, height: 100)
.contentShape(Rectangle())
.onTapGesture(count: 1, perform: {
greenOn.toggle()
print("Tapped")
})
Rectangle()
.fill(Color.blue)
.opacity(blueOn ? 1.0 : 0.5)
.frame(width: 100, height: 100)
.onTapGesture(count: 1, perform: {
blueOn.toggle()
print("Tapped 2")
})
}
}
}
Try to tap the green and blue squares. Best case for me (Big Sur, 11.0.1) is that sometimes onTapGesture will get called.
The easy solution is to convert them to Buttons instead -- but, there are plenty of situations where that isn't ideal (Buttons, for example, don't play nicely with DragGesture).
Is there any way around this bug? Some way to make it work? Or am I stuck until an update restores functionality with Catalina/iOS 14