Adding an application to the Privacy Pane

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Simon Knight
Posts: 845
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Adding an application to the Privacy Pane

Post by Simon Knight » Thu Dec 01, 2022 11:19 am

Hi,
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
Instance Method
requestAccessToEntityType:completion:
Prompts the user to grant or deny access to event or reminder data.
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 ;-).

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
Unfortunately removal made no difference except that my library from 2020 no longer works because it needs permissions - Doh!

Will someone with greater expertise with Apple development confirm or otherwise that my understanding of what should happen is correct.

Thanks

S
best wishes
Skids

Simon Knight
Posts: 845
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Re: Adding an application to the Privacy Pane

Post by Simon Knight » Sat Dec 03, 2022 12:40 pm

If seems that Livecode 10 dp 1 has an issue when building applications for mac. I tried my test app on 9.6.8 and the app prompts for access to the calendar as I expected (well hoped).

I think my ideas of how permission is suppose to work are basically correct.

S
best wishes
Skids

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Adding an application to the Privacy Pane

Post by Klaus » Sat Dec 03, 2022 1:00 pm

Simon,

we are currently at LC 10 dp 4 (FOUR)!
https://downloads.livecode.com/livecode/
Maybe try again with that version?


Best

Klaus

Simon Knight
Posts: 845
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Re: Adding an application to the Privacy Pane

Post by Simon Knight » Sat Dec 03, 2022 4:08 pm

Hi Klaus,

Will do.

S
best wishes
Skids

Post Reply

Return to “Mac OS”