I have several target in my Xcode project each of them having an associated domain but a different one.
I'd like to have the same entitlements file for all my target and having a script with PListBuddy to change the value the domain.
I already have a script that works that I launch during the Build Phases that edit the file correctly :
case $TARGET_NAME in
"EN6") fireBaseUrl="FOO.app.goo.gl";;
"ES5") fireBaseUrl="BAR.app.goo.gl";;
"SVT-C4") fireBaseUrl="FOOFOO.app.goo.gl";;
"PC5") fireBaseUrl="BARBAR.app.goo.gl";;
*) fireBaseUrl="FOOBAR.app.goo.gl";;
esac
# Universal links used by Firebase
associatedDomainKey="com.apple.developer.associated-domains"
/usr/libexec/PlistBuddy -c "delete ${associatedDomainKey}" app.entitlements
/usr/libexec/PlistBuddy -c "add :${associatedDomainKey} array" -c "add :${associatedDomainKey}:0 string applinks:${fireBaseUrl}" app.entitlements
The problem is that I have a "The executable was signed with invalid entitlements." error when installing the app on a device.
I guess it's because after being edited the entitlements file doesn't corresponds to the entitlements included in the provisioning profile anymore.
Do you know if there is a way to do what I want ? Using fastlane, shell script or anything... (I have 40 targets so I'd really like to get only one entitlements file for all of them)