Is it possible to avoid keeping info.plist files around?

Hi,

With Apple’s notarisation, one has to add key/value pairs in the info.plist in order to make some features working (like NSAppleEventsUsageDescription to be able to send AppleEvents).
The only way I know to achieve this in Xojo, currently, is to have an info.plist file physically on disk (then dragged to the project).
Would it not be nice to have a simple editor, right in Xojo, to put key/value pairs to be added in the info.plist at compile time, allowing to get rid of these extra files laying around?

In my workflow, I also sometimes forget to turn the AppleScript switch on in AppWrapper. While it’s not the end of the world, I’d find it nice if AppWrapper could detect the presence of a NSAppleEventsUsageDescription key inside the info.plist file and switch AppleScript (in “capabilities”) on when there’s this key (without user interaction).

Wouldn’t this be nice?

It can be done with build automation. Something like

Var App As String = CurrentBuildLocation + "/""" + CurrentBuildAppName + "/Contents/Info"""
Call DoShellCommand("/usr/bin/plutil -insert UTExportedTypeDeclarations.3.UTTypeIcons -json '{""UTTypeIconText"":""Auth"",""UTTypeIconBadgeName"":""GenericCenterIcon""}' " + App + ".plist")

Works without needing the files. You can see it in the real world at Beacon/Build Automation.xojo_code at master · thommcgrath/Beacon · GitHub starting at line 39.

A built in editor, while nice, it’s rather complex.

2 Likes

Thank you. Oddly enough, I’ve never tried scripting build automation (first time it’d solve a problem for me).

Well, a listbox with 2 columns (key and value), and “add” and “remove” buttons would suffice. Then, I guess the compiler would have no trouble in adding these to the info.plist file.
For simple projects, there would be no need for dictionary support. But even then, the listbox would be hierarchical.

Honestly, I don’t think it’s worth doing. Xcode’s plist editor is always going to be better, and keeping a plist file to merge in is a pretty low cost. It keeps Xojo focused on other things.

4 Likes

I can agree with your arguments, since there’s the automated way.

There is a capability editor for iOS projects. Something like that could be adapted for macOS as well.

2 Likes

It can be done with App Wrapper, so the plist entries are configured with all the other settings you need to deliver your application.

If you want to manually edit the plist, use “Information Property List” on the “Edit” menu, otherwise many options are configured via checkboxes and fields in the main GUI.

2 Likes

you mean for this particular file you use xcode or in general you use xcode to manage all plist ?
Plus i was wondering what are the ways to create/read/write plist files in xojo ? might move some of my prefs to plist files

Official ways of editing plist files are through declares or plugins. I have the code in the Ohanaware App Kit to do this (which is used by App Wrapper).

Unofficially, you can edit the text based plist files via XML classes, however there’s also a binary format, which to the best of my knowledge is a private format.

1 Like

I mean for editing plist files yourself. In code, there are better ways.

I use
https://www.fatcatsoftware.com/plisteditpro/
for quite some years, did you mean that xcode could generate a different file for this case ?

1 Like

No, a plist file is a plist file. If you have a tool you like, use it.

I have not known this application before… I must say - really nice application and a beautiful website as well.