Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Saving, Document Extensions, and Preferences (Info.plist)

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...

like image 581
user2000809 Avatar asked May 05 '13 23:05

user2000809


People also ask

What is the info plist file?

Information Property-List Files (Info.plist) The Info. plist file contains critical information about the configuration of an iOS mobile app—such as iOS versions that are supported and device compatibility—which the operating system uses to interact with the app.

What is an Apple plist?

Apple Property List (PLIST) files are used to store serialized objects. They are mostly used in macOS, iOS, NeXTSTEP, and GNUstep programming frameworks.

Where are plist stored in iOS?

plist . This name of this file is case sensitive and must have an initial capital letter I . In iOS apps, this file resides in the top-level of the bundle directory. In macOS bundles, this file resides in the bundle's Contents directory.

How do I edit info plist on Mac?

If you need to edit these items, Control-click (or right-click) Info. plist in the sidebar and select Edit Manually. This allows you to add or edit items in raw XML format.


2 Answers

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>.

like image 57
user2000809 Avatar answered Sep 24 '22 23:09

user2000809


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.

like image 24
Mojo66 Avatar answered Sep 24 '22 23:09

Mojo66