A long time ago I made a simple CoreData, document-based app and used Xcode to make a file type/extension to go along with it. Now, I'm following the WWDC videos from last year to try to update to SwiftData. The instructions show that the Exported Type Identifier in the target's info should "conform" to com.apple.package. I didn't include that conformance in the original CoreData project. When I try to build the partially-remade project for initial testing, it immediately crashes with: "_SwiftData_SwiftUI/Documents.swift:282: Fatal error: The document type is *** which does not conform to com.apple.package. This initializer expects the document type to be a package."
If I just change the file extension in the Exported Type Identifier (and the UTType class extension code) to anything other than the original extension from years ago, the app will load, so the rest of the type setup must be correct. My guess was that the issue is macOS recognizes the file type from my older program, and knows it didn't used to conform to com.apple.package, so it won't allow the new SwiftData version to run, since conformance is required.
I tried opening the original CoreData project in Xcode, adding com.apple.package to "conforms to" in the Exported Type Identifier and running it, and confirmed I can still open my old files. I hoped that would "update" the system that it's now conforming. However, going back to the SwiftData project, it still won't load, and gives the same fatal error.
I then tried running my SwiftData project on another computer that has never run the CoreData version, and it built just fine - which seems to confirm the issue is my laptop's prior knowledge of that file type.
I tried asking this question on StackOverflow, but there's debate about whether it's solvable by programming or if it can only be solved at the OS level, so the question was closed. Is there a way to make macOS update the file type (either through programming or an OS setting) so it knows conformance to com.apple.package has been added? Or else, can I make macOS forget it's ever seen that file type/extension, so when the program is opened next time it registers the type with the new conformance?