@@ -336,13 +336,18 @@ build_for_arch() {
336336 SPM_CACHE_DIR=" ${HOME} /.spm-cache"
337337 mkdir -p " $SPM_CACHE_DIR "
338338
339- # Detect provisioning profile UUID for iCloud entitlements
340- local PROFILE_SPECIFIER=" "
339+ # Inject provisioning profile UUID into pbxproj for the main app target only.
340+ # Command-line PROVISIONING_PROFILE_SPECIFIER applies to ALL targets (plugins,
341+ # SPM packages) which breaks them. Instead, replace the empty specifier in
342+ # the main app target's build settings directly.
341343 PROFILE_PATH=$( find ~ /Library/MobileDevice/Provisioning\ Profiles -name " *.provisionprofile" -print -quit 2> /dev/null)
342344 if [ -n " ${PROFILE_PATH:- } " ]; then
343- PROFILE_SPECIFIER=$( /usr/libexec/PlistBuddy -c " Print UUID" /dev/stdin <<< " $(security cms -D -i " $PROFILE_PATH " 2>/dev/null)" || true)
344- if [ -n " $PROFILE_SPECIFIER " ]; then
345- echo " 📋 Using provisioning profile: $PROFILE_SPECIFIER "
345+ PROFILE_UUID=$( /usr/libexec/PlistBuddy -c " Print UUID" /dev/stdin <<< " $(security cms -D -i " $PROFILE_PATH " 2>/dev/null)" || true)
346+ if [ -n " ${PROFILE_UUID:- } " ]; then
347+ echo " 📋 Injecting provisioning profile into pbxproj: $PROFILE_UUID "
348+ # The main app target has PROVISIONING_PROFILE_SPECIFIER = "";
349+ # Other targets don't have this key at all, so this is safe.
350+ sed -i ' ' " s/PROVISIONING_PROFILE_SPECIFIER = \"\" ;/PROVISIONING_PROFILE_SPECIFIER = \" $PROFILE_UUID \" ;/g" " $PROJECT /project.pbxproj"
346351 fi
347352 fi
348353
@@ -357,7 +362,6 @@ build_for_arch() {
357362 CODE_SIGN_IDENTITY=" $SIGN_IDENTITY " \
358363 CODE_SIGN_STYLE=Manual \
359364 DEVELOPMENT_TEAM=" $TEAM_ID " \
360- ${PROFILE_SPECIFIER: +PROVISIONING_PROFILE_SPECIFIER=" $PROFILE_SPECIFIER " } \
361365 ${ANALYTICS_HMAC_SECRET: +ANALYTICS_HMAC_SECRET=" $ANALYTICS_HMAC_SECRET " } \
362366 -skipPackagePluginValidation \
363367 -clonedSourcePackagesDirPath " $SPM_CACHE_DIR " \
0 commit comments