I am struggling to add my livecode application to the Privacy Pane of System Preferences and wonder if someone with greater expertise of how AppleOS and even iOS work in this regard will comment.
As I understand it when first run on any given Mac computer an application should request that the user grant permissions as the application needs. In my case my Livecode application needs permission to access the Calendar.app via an instance of the EventStore.
Reading Apple's documentation and a number of technical websites leads me to believe that when a request for access command is issued the OS will present a dialog. The dialog allows either permission granted or permission denied. No matter which is selected by the user the application will now be listed in the relevant pane. In my example "myApp" will be in the list of applications that have requested access to "Calendars". Once an application is in the list the OS will not present further dialogs on subsequent running of the application. Instead the application itself should check if it needs permission and then prompt the user to tick the check box in the privacy pane. I think that this is how it also works on iOS.
I am trying to have "myApp" generate the necessary dialog. Looking at the dictionary I see that Livecode Script provides one property named 'securityPermissions' but this has quite broad coverage and does not have the granularity to allow, for example, "myApp" access to Calendar events.
I have created a library extension, using LCB, that is able to return an array of Calendar Events. The first version was written in early 2020 when I was using an earlier version of Mac OS. It seems that, by some now forgotten method, I managed to get Livecode added to Calendar's privacy tab thus allowing the extension to function.
I am updating my library extension with the aim of adding privacy authorisation. To achieve this I am using a Method of an instance of the EventStore class. Apple head the description of the Method as follows
I interpret this description to mean that the user is prompted to grant permission when the method is called, but please bear in mind I don't really have a clue .Instance Method
requestAccessToEntityType:completion:
Prompts the user to grant or deny access to event or reminder data.
Unfortunately when I call this method from "myApp" no prompt is displayed. So thinking that the reason nothing was displayed was because Livecode was already listed I used the terminal and removed Livecode from the pane.
Code: Select all
tccutil reset Calendar com.runrev.livecode
Will someone with greater expertise with Apple development confirm or otherwise that my understanding of what should happen is correct.
Thanks
S