How to reproduce error: "The open file operation failed to connect to the open and save panel service"

This is a copy of my post from StackOverflow to find a wider audience


I've received the following rejection of a SwiftUI MacOS app:

"We discovered one or more bugs in your app when reviewed on Mac running macOS 13.2.1. We received the attached error message at launch."

The full message is:

The open file operation failed to connect to the open and save panel service.

with the attached screenshot:

I've never seen this message before, and I've no idea how to reproduce it.

Per Technical Q&A QA1778, How to reproduce bugs reported against Mac App Store submissions, I've exported the archived app and run on a guest account on macOS 13.2.1, but it runs and can open files as expected.

I've tried opening a file on an external drive, and on iCloud Drive (successfully).

If it helps, it's a SwiftUI DocumentGroup viewing app.

Has anybody seen this message before, or has any idea how I could reproduce it?

Accepted Reply

And considering everything said above, try to run your app on a computer that does not have installed Xcode to reproduce the issue.

Replies

Hi!

Can you please file a feedback with the details and share its number here? It would be great if you could include the Info.plist, and your Document type(s) setup. Also, is it Catalyst, Rosetta, Multiplatform Document app, or a plain macOS Document app?

@julia_brockovich I've submitted feedback FB12021387.

Document Types from info.plist:

<?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>CFBundleTypeIconSystemGenerated</key>
			<integer>1</integer>
			<key>CFBundleTypeName</key>
			<string>Core Data Model</string>
			<key>CFBundleTypeRole</key>
			<string>Viewer</string>
			<key>LSHandlerRank</key>
			<string>Alternate</string>
			<key>LSItemContentTypes</key>
			<array>
				<string>com.apple.xcode.model.data</string>
			</array>
		</dict>
	</array>
	<key>ITSAppUsesNonExemptEncryption</key>
	<false/>
</dict>

</plist>

The app is a macOS Document app built using SwiftUI

Thank you!

Does this app open miscellaneous .xcdatamodeld files? Or does it use Core Data to store documents? If the app is a .xcdatamodeld viewer/editor, I am wondering if a computer that does not have Xcode installed knows about the com.apple.xcode.model.data content type. Currently, the Info.plist does not contain the type definition; it just states that it wants to work with files that conform to com.apple.xcode.model.data.

If the operating system is unaware of the type we are trying to use, we can expect all sorts of problems. In this case, you need to declare the content type, and you can specify that your app is not the "main" app to open these (in case there's Xcode is installed). Take a look at a "Handler rank" in Xcode project settings -> Info tab → Document types.

If it is the former – the app uses Core Data to store documents, like UIManagedDocument or NSPersistentDocument, I'd suggest declaring your own type as well. Probably the app can't open every Core Data store and expects to find there specific models. Also, I think that the compiled data model file has a different content type, not com.apple.xcode.model.data.

I am not sure if it helps to reproduce or fix the issue in question. But current configuration is not supported by the operating system. You might want to take a look at https://developer.apple.com/documentation/uniformtypeidentifiers/defining_file_and_data_types_for_your_app

And considering everything said above, try to run your app on a computer that does not have installed Xcode to reproduce the issue.

Thank you for that - running on a Mac without Xcode installed did indeed reproduce the issue!

Adding the following to the info.plist fixed the error that was appearing:

<key>UTImportedTypeDeclarations</key>
<array>
    <dict>
        <key>UTTypeDescription</key>
        <string>Core Data Model</string>
        <key>UTTypeIcons</key>
        <dict/>
        <key>UTTypeIdentifier</key>
        <string>com.apple.xcode.model.data</string>
        <key>UTTypeTagSpecification</key>
        <dict>
            <key>public.filename-extension</key>
            <array>
                <string>xcdatamodel</string>
            </array>
        </dict>
    </dict>
</array>

The app is used to open and view .xcdatamodel file (which is actually a package), and then writes an additional file within the .xcdatamodel package. Unfortunately, when Xcode isn't installed, the .xcdatamodel isn't recognised as a package, just a regular folder.

I resolved this by adding a new exported type that conformed to com.apple.package

<key>UTExportedTypeDeclarations</key>
<array>
    <dict>
        <key>UTTypeConformsTo</key>
        <array>
            <string>com.apple.xcode.model.data</string>
            <string>com.apple.package</string>
        </array>
        <key>UTTypeDescription</key>
        <string>Core Data Model</string>
        <key>UTTypeIcons</key>
        <dict/>
        <key>UTTypeIdentifier</key>
        <string>uk.co.joylordsystems.xcode.model.data</string>
        <key>UTTypeTagSpecification</key>
        <dict>
            <key>public.filename-extension</key>
            <array>
                <string>xcdatamodel</string>
            </array>
        </dict>
    </dict>
</array>

This seems to have resolved my issues.

Again, thank you for your help!

Add a Comment