On macOS Open system settings > Security & Privacy > Calendar - Follow-up: 814223720

Hi,

I have a Mac app that uses calendar. When the user has not granted access and still wants to access the calendar I would like to open System Settings Privacy and Security pane for calendar on the mac. How can I do this?

  1. Is it ok to open system settings this way?
  2. Or is there a better way?
  3. I would like to publish this app to the AppStore so want to know if this is ok?
if let urlString = URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_Calendars") {
    NSWorkspace.shared.open(urlString)
    
}

Accepted Reply

You can find my advice on this topic on this thread. It’s written for iOS but the same basic rules apply on all our platforms.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • @eskimo Thanks a lot, just curious how in the mac Maps app when location permission is not granted, when the user taps on current location button it shows an alert which opens the Privacy & Security pane

  • @eskimo I forgot to mention I have enabled Calendar under Capabilities and added INFOPLIST_KEY_NSCalendarsUsageDescription which prompts the user for Calendar access when needed

  • @eskimo, Hoping one day macOS System Settings has app level settings, IMHO that would be a safer option (just like in iOS) so that devs don't abuse the option. Sorry just wishful thinking, thanks once again

Add a Comment

Replies

Much information here (for iOS, but should apply with some adaptations to MacOS).

https://stackoverflow.com/questions/28152526/how-do-i-open-phone-settings-when-a-button-is-clicked

  • @Claude31 The main issue is with the URL string. Question is whether this opening "x-apple.systempreferences:com.apple.preference.security?Privacy_Calendars" URL would be considered as accessing private API in the Apple Store. Original code I posted works but not sure it is allowed.

Add a Comment

You can find my advice on this topic on this thread. It’s written for iOS but the same basic rules apply on all our platforms.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • @eskimo Thanks a lot, just curious how in the mac Maps app when location permission is not granted, when the user taps on current location button it shows an alert which opens the Privacy & Security pane

  • @eskimo I forgot to mention I have enabled Calendar under Capabilities and added INFOPLIST_KEY_NSCalendarsUsageDescription which prompts the user for Calendar access when needed

  • @eskimo, Hoping one day macOS System Settings has app level settings, IMHO that would be a safer option (just like in iOS) so that devs don't abuse the option. Sorry just wishful thinking, thanks once again

Add a Comment