Saving, Document Extensions, and Preferences (Info.plist)
Asked Answered
L

2

5

I have a simple document-based Cocoa app call "RaiseMan". When I go to save a file, this message appears in the console:

-[NSDocumentController fileExtensionsFromType:] is deprecated, and does not work when passed a uniform type identifier (UTI). If the application didn't invoke it directly then the problem is probably that some other NSDocument or NSDocumentController method is getting confused by a UTI that's not actually declared anywhere. Maybe it should be declared in the UTExportedTypeDeclarations section of this app's Info.plist but is not. The alleged UTI in question is "com.bignerdranch.raiseman-doc".

If I save the current file as, say, "Test", it turns out a file that opens as a .plist, and does not open with the Raiseman app. If I save it as "Test.rsmn" (explicitly typing the extension), it saves it as a Raiseman-type file, but when I re-open the file, I cannot access any user preferences or the preferences panel (.xib).

Context:I am currently working my way through Aaron Hillegass's Programming for Mac OS X, Chapter 13...

Lethargic answered 5/5, 2013 at 23:50 Comment(0)
L
5

So, in order to achieve desired results I made sure that under the Properties inspector for the project Targets, the Identifier and UTI type (in the Document Type table), as well as the UT Type identifier in the .plist file were all the same <key>UTTypeIdentifier</key> <string>"com.yourDomainName.ProductName"</string>.

Lethargic answered 6/5, 2013 at 13:39 Comment(2)
In short, if you made your file type in "Document Types", you'll need to do it again in "Exported UTIs" and "Imported UTIs".Background
Actually, just "Imported UTIs".Background
I
3

The solution for me was to create a new Exported UTI (like the warning says) and copy the data from the Document Type over. After a Clean Build Folder (⇧⌘K) the warning went away. I did not create an Imported UTI.

The process is documented here:

If you define a custom document type with its own UTI, you must export the UTI.

Institution answered 12/9, 2019 at 10:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.