How to read APS Environment entitlement

Is there a simple way to get the value of the APS Environment setting in the Entitlements file from within a SwiftUI app? As others have noted, when the app is run from Xcode, this value is set to "development" but when run from Archive'd TestFlight version, it is set to something else (presumably "production"). I need to know which environment the app should use for registering its device token for notifications.

What platform are you targeting?

This matters because on macOS you can access your own entitlements via the code signing API (SecCode). However, there’s not available on other Apple platforms.

Share and Enjoy

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

How to read APS Environment entitlement
 
 
Q