kSecAttrAccessGroup and $(AppIdentifierPrefix)

As I understand it, to share keychain data between a Watch app and the iOS app, you need to set up a keychain access group entitlement, and make the keychain item with the kSecAttrAccessGroup attribute and a value that matches that keychain access group entititlement.


Xcode sets up an entitlement file that looks like "$(AppIdentifierPrefix)some.identifier.here". In code, though, how do we get an app identifier prefix to make the matching kSecAttrAccessGroup value? Or does the kSecAttrAccessGroup value exclude the $(AppIdentifierPrefix) part of the entitlement item?

In code, though, how do we get an app identifier prefix to make the matching kSecAttrAccessGroup value?

I generally use a C pre-processor variable for this, and then use Xcode's Preprocessor Macros (

GCC_PREPROCESSOR_DEFINITIONS
) build setting to pass the "$(AppIdentifierPrefix)" value through to my code.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
kSecAttrAccessGroup and $(AppIdentifierPrefix)
 
 
Q