Alerts to allow location information do not appear when the Mac App's is signed

I am creating an app that runs on Mac using objective-c.
Since the app requires permission for location information, I used NSLocationUsageDescription to display an OS alert prompting the user to allow location information.

When built, the app displays an OS alert prompting the user to allow location information, as expected.
However, after signing this app, it no longer displays alerts. The signature was added like this.
codesign --force --timestamp --options runtime --sign "SIGN" "AppName"

   

Why does just adding a signature stop the OS alert prompting the user to allow location information to appear?
Also, is there a way to display OS alerts even with a signature?

Answered by DTS Engineer in 772257022

You’re signing your app with the hardened runtime enabled (which is required for direct distribution using Developer ID signing). The hardened runtime enables a bunch of extra security checks. One of those is that you must claim the com.apple.security.personal-information.location entilement if you want to use location services. See Hardened Runtime for the details.

Share and Enjoy

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

Accepted Answer

You’re signing your app with the hardened runtime enabled (which is required for direct distribution using Developer ID signing). The hardened runtime enables a bunch of extra security checks. One of those is that you must claim the com.apple.security.personal-information.location entilement if you want to use location services. See Hardened Runtime for the details.

Share and Enjoy

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

@eskimo , here you go:
Thank you for your answer.
By setting "com.apple.security.personal-information.location" in the entilement as you taught, the alert is now displayed.

But an additional problem arose.

  • "***" would like to use your current location.
  • Don't Allow
  • Allow

Even if you select "Allow" in the above alert, the app's location information will not be turned on in the "Location Services" item of "Security and Privacy" in System Preferences.

Why?

Alerts to allow location information do not appear when the Mac App's is signed
 
 
Q