Skip to content

Conversation

ncooke3
Copy link
Member

@ncooke3 ncooke3 commented Sep 6, 2024

+++ b/FirebaseAuth/Tests/SampleSwift/AuthenticationExample/SwiftApplication.plist
@@ -2,6 +2,8 @@
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
+       <key>AppIdentifierPrefix</key>
+       <string>$(AppIdentifierPrefix)</string>

Will enable you to easily test keychain groups without further configuring the sample app. This should dynamically evaluate to TEAMID.com.google.firebase.auth.keychainGroup1, but I did notice very sneaky behavior where the cert's team ID is not used as the app ID prefix for simulator builds. This caused the missing entitlements -34018 error when testing because kecyhain group I was looking for was not the same as the keychain group the app had provisioned on simulator. Using the $(AppIdentifierPrefix) variable as opposed to hardcoding something will ensure it's always what Xcode is looking for.

private func toggleAccessGroup() {
if AppManager.shared.auth().userAccessGroup == nil {
guard let bundleDictionary = Bundle.main.infoDictionary,
let group = bundleDictionary["AppIdentifierPrefix"] as? String else {
fatalError("Configure AppIdentifierPrefix in the plist")
}
AppManager.shared.auth().userAccessGroup = group + "com.google.firebase.auth.keychainGroup1"
} else {
AppManager.shared.auth().userAccessGroup = nil
}
}

#no-changelog

@ncooke3 ncooke3 merged commit fab6834 into main Sep 6, 2024
56 checks passed
@ncooke3 ncooke3 deleted the nc/add-appid-prefix branch September 6, 2024 16:23
@firebase firebase locked and limited conversation to collaborators Oct 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants