Skip to content

Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.

Strip extended attributes before the placeholder ad-hoc signature

LNPANDY974119755dd3
diff --git a/dm/ios/tools/build_ipa.sh b/dm/ios/tools/build_ipa.sh
index 4ef2d197..666cbd6c 100755
--- a/dm/ios/tools/build_ipa.sh
+++ b/dm/ios/tools/build_ipa.sh
@@ -132,6 +132,10 @@ if [ "$PREPARE_XCODE" != YES ] && [ -n "${DM_ENTITLEMENTS-default}" ]; then
if [ -n "${DM_ENTITLEMENTS:-}" ]; then cp "$DM_ENTITLEMENTS" "$APP/DmIOS.entitlements" || die "copy DM_ENTITLEMENTS"
else printf '%s\n' '<?xml version="1.0" encoding="UTF-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>com.apple.developer.kernel.increased-memory-limit</key><true/></dict></plist>' > "$APP/DmIOS.entitlements" || die "entitlements"; fi
+ # codesign refuses a bundle whose files carry resource forks, Finder information, quarantine or
+ # provenance attributes ("resource fork, Finder information, or similar detritus not allowed");
+ # files copied into the bundle (the icon, resources staged from a Downloads folder) can bring them
+ xattr -cr "$APP" 2>/dev/null
codesign --force --sign - --entitlements "$APP/DmIOS.entitlements" "$APP" || die "ad-hoc sign with entitlements (the sideloader re-signs; this only carries the request)"
codesign -d --entitlements :- "$APP" 2>/dev/null | grep -q increased-memory-limit || die "entitlements did not make it into the placeholder signature"
t "entitlements: increased-memory-limit embedded in the placeholder signature"
diff --git a/scripts/sync_upstream.py b/scripts/sync_upstream.py
index ad392f27..ccc32d4c 100644
--- a/scripts/sync_upstream.py
+++ b/scripts/sync_upstream.py
@@ -269,6 +269,10 @@ if [ "$PREPARE_XCODE" != YES ] && [ -n "${DM_ENTITLEMENTS-default}" ]; then
if [ -n "${DM_ENTITLEMENTS:-}" ]; then cp "$DM_ENTITLEMENTS" "$APP/DmIOS.entitlements" || die "copy DM_ENTITLEMENTS"
else printf '%s\\n' '<?xml version="1.0" encoding="UTF-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>com.apple.developer.kernel.increased-memory-limit</key><true/></dict></plist>' > "$APP/DmIOS.entitlements" || die "entitlements"; fi
+ # codesign refuses a bundle whose files carry resource forks, Finder information, quarantine or
+ # provenance attributes ("resource fork, Finder information, or similar detritus not allowed");
+ # files copied into the bundle (the icon, resources staged from a Downloads folder) can bring them
+ xattr -cr "$APP" 2>/dev/null
codesign --force --sign - --entitlements "$APP/DmIOS.entitlements" "$APP" || die "ad-hoc sign with entitlements (the sideloader re-signs; this only carries the request)"
codesign -d --entitlements :- "$APP" 2>/dev/null | grep -q increased-memory-limit || die "entitlements did not make it into the placeholder signature"
t "entitlements: increased-memory-limit embedded in the placeholder signature"