I am developing a macOS word-processing app that should be distributed via the Apple App Store. Some of the app's functions like generating HTML and PDF exports should be automatable via Shortcuts and via shell scripts.
To support the latter, I plan to include a command line tool inside the app that can be called from the Terminal or a shell script. The tool should be able to instruct the main app to then perform the desired commands.
A well-known AppStore app that uses this design is BBEdit which also contains multiple command line tools that offer functionality from the main app to users of the Terminal.
My technical questions now are:
Should the command line tool executable be sandboxed and if yes, how?
Even after many trials, I have not found a way to make a working sandboxed command line tool. If a sandboxed tool is started from the Terminal, it is immediately terminated with an exception in _libsecinit_appsandbox.cold.12. I am aware of the Apple developer documentation article Embedding A Helper Tool In A Sandboxed App, but it addresses a different architecture in which the helper tool is started from the main app and therefore is able to inherit its sandbox.
BBEdit is only sandboxing the main app, but not its embedded command line tools and is still allowed in the App Store. Is this the way to go for me as well or does BBEdit get some special treatment in the App Store?
How can the command line tool pass the permission to access files to the main app?
As my main app is sandboxed, it needs explicit permission from the user to be able to access files. Users of a command line tool give this permission by providing file paths as arguments. How can I pass these permissions along to the main app? BBEdit is able to do this even when the user has not given it full-disk access. I know that it is using Apple Events for the communication between the command line tool and the main app, but I am not sure how this allows to pass permissions. Can anyone shed light on how to implement a solution here?
Thanks!
Post
Replies
Boosts
Views
Activity
I created a CSImportExtension in my UIDocument-based app to make the content of my documents searchable.
Now I can successfully search for the content from the iOS home-screen search. But when I try the same search in the Files.app or from the document browser in my app, no results are shown.
In the update attributes function in the extension, I am populating the following fields of the passed-in CSSearchableItemAttributeSet: keywords, contentDescription, displayName
Does anybody know what I have to do to make the content searchable from all locations? I tried the same within the Pages, Numbers and Keynote apps and their document contents is found beautifully from the Files.app or from their document browsers. So it seems to work in principle.
Thanks and cheers
Frank