Duplicate CFBundleIdentifier in copied _Testing_* overlay frameworks breaks simulator install
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 62/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- ios, shell
- 领域
- build-system, mobile
调研方向
该缺陷位于 InjectionNext 构建阶段运行的 copy_bundle.sh 复制循环中,以及建议的变通脚本 fix_testing_framework_ids.sh 中。先针对 Xcode 的 iPhoneSimulator Frameworks 目录运行 issue 中的 PlistBuddy 循环,确认 _Testing_CoreTransferable.framework 报告的是 CoreGraphics 标识符。完成标准是:Debug 构建能安装到模拟器上,每个 Testing* 覆盖层都具有唯一的 CFBundleIdentifier,并且该脚本在非 Debug 配置下不执行任何操作。
由索引模型根据 Issue 内容生成。
描述
Note: includes fix
Summary
copy_bundle.sh copies every Testing*.framework from the platform developer frameworks directory into the app's Frameworks/ directory. Apple ships _Testing_CoreTransferable.framework with a copy-pasted CFBundleIdentifier that duplicates _Testing_CoreGraphics.framework's. Two frameworks sharing one identifier inside a single app bundle makes installd reject the install, so any Debug build with the InjectionNext build phase fails to launch on the simulator.
Error
Please try again later. Found bundle at
/Users/<me>/Library/Developer/CoreSimulator/Devices/<UDID>/data/Library/Caches/
com.apple.mobile.installd.staging/temp.Y6ODte/extracted/Payload/Allstar.app/
Frameworks/_Testing_CoreGraphics.framework with the same identifier
(com.apple.dt.swift-testing.overlay.CoreGraphics) as bundle at
.../Frameworks/_Testing_CoreTransferable.framework
Root cause
The identifiers as shipped by Xcode:
$ D="$(xcode-select -p)/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks"
$ for f in "$D"/_Testing_*.framework; do
echo "$(basename $f): $(/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' "$f/Info.plist")"
done
_Testing_CoreGraphics.framework: com.apple.dt.swift-testing.overlay.CoreGraphics
_Testing_CoreImage.framework: com.apple.dt.swift-testing.overlay.CoreImage
_Testing_CoreTransferable.framework: com.apple.dt.swift-testing.overlay.CoreGraphics ← wrong
_Testing_Foundation.framework: com.apple.dt.swift-testing.overlay.Foundation
_Testing_UIKit.framework: com.apple.dt.swift-testing.overlay.UIKit
This is an Apple bug in the toolchain, but InjectionNext is what surfaces it: nothing else copies these overlays into a shipping app bundle. The relevant loop in copy_bundle.sh:
(cd "$PRODUCTS_DIR" && for fwork in $TESTING_FRAMEWORKS \
"$PLATFORM_DEVELOPER_LIBRARY_DIR"/Frameworks
TESTING_COPIED="$CODESIGNING_FOLDER_PATH/Frameworks/$(basename "$fwork")"
if [ -f "$fwork/Info.plist" -a ! -d "$TESTIN
rsync -a "$fwork" "$CODESIGNING_FOLDER_PATH/Frameworks" &&
codesign -f --sign "$EXPANDED_CODE_SIGN_
--preserve-metadata=identifier,entitlements,flags ... "$TESTING_COPIED"
fi
done)
Note --preserve-metadata=identifier — the bad identifier is carried through to the signature as well.
Reproduce
- Add the standard InjectionNext run-script phase to an iOS app target.
- Build & run in Debug on a simulator with an Xansferable.framework carries the CoreGraphicsidentifier.
- Install fails with the error above. Allstar.ath overlays with identical CFBundleIdentifiers.
Environment
┌───────────────┬──────────────────────┐
│ │ │
├───────────────┼──────────────────────┤
│ Xcode │ 27.1 │
├───────────────┼──────────────────────┤
│ InjectionNext │ 2.0.1 |
├───────────────┼──────────────────────┤
│ Destination │ iOS Simulator, Debug │
└───────────────┴──────────────────────┘
Suggested fix (upstream)
Derive each overlay's identifier from its own fr, and stop preserving identifier when re-signing:
(cd "$PRODUCTS_DIR" && for fwork in $TESTING_FRA
"$PLATFORM_DEVELOPER_LIBRARY_DIR"/Frameworks/_Testing_*.framework; do
TESTING_COPIED="$CODESIGNING_FOLDER_PATH/Fra")"
if [ -f "$fwork/Info.plist" -a ! -d "$TESTING_COPIED" ]; then
rsync -a "$fwork" "$CODESIGNING_FOLDER_P
# Xcode ships _Testing_CoreTransferable with CoreGraphics' identifier;
# installd rejects two bundles sharing a
OVERLAY="$(basename "$fwork" .framework)" &&
/usr/libexec/PlistBuddy -c \
"Set :CFBundleIdentifier com.apple.dt.swift-testing.overlay.${OVERLAY#_Testing_}" \
"$TESTING_COPIED/Info.plist" &&
codesign -f --sign "$EXPANDED_CODE_SIGN_IDENTITY" --timestamp=none \
--preserve-metadata=entitlements,fla
--generate-entitlement-der "$TESTING_COPIED"
fi
done)
Rewriting all overlays (rather than special-casing CoreTransferable) keeps the script correct if Apple duplicates another
identifier later.
Workaround (verified working)
For anyone hitting this before an upstream fix lld phase after the InjectionNext phase thatrepairs the copied overlays in place.
BuildScripts/fix_testing_framework_ids.sh:
#!/bin/bash
#
# Apple ships _Testing_CoreTransferable.framework with the same CFBundleIdentifier as
# _Testing_CoreGraphics.framework (com.apple.dt.Graphics).
# InjectionNext's copy_bundle.sh copies every _Testing_* overlay into the app, and
# installd refuses to install a bundle containinidentifier.
#
# Rewrite each copied overlay's identifier to ma, then re-sign.
# Must run after the InjectionNext build phase.
[[ "$CONFIGURATION" =~ Debug ]] || exit 0
FRAMEWORKS="$CODESIGNING_FOLDER_PATH/Frameworks"
[ -d "$FRAMEWORKS" ] || exit 0
shopt -s nullglob
for fwork in "$FRAMEWORKS"/_Testing_*.framework; do
plist="$fwork/Info.plist"
[ -f "$plist" ] || continue
name="$(basename "$fwork" .framework)"
want="com.apple.dt.swift-testing.overlay.${n
have="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' "$plist" 2>/dev/null)"
[ "$have" == "$want" ] && continue
echo "fixing $name: $have -> $want"
/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier $want" "$plist" &&
codesign -f --sign "${EXPANDED_CODE_SIGN_IDEe \
--preserve-metadata=entitlements,flags --generate-entitlement-der "$fwork"
done
Then chmod +x it and add a New Run Script Phase last (after InjectionNext):
"${SRCROOT}/BuildScripts/fix_testing_framework_i
It's idempotent, no-ops outside Debug, and --prey drops identifier so the new one makes it intothe signature.
- 主要语言
- Swift
- 星标
- 437
- 派生
- 32
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
johnno1962/InjectionNext 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 56/100
johnno1962/InjectionNext#173 · 2 条评论 ·
-
难度 3/5 1-2 天 新手友好度 65/100
johnno1962/InjectionNext#167 ·
-
难度 4/5 3-5 天 新手友好度 38/100
johnno1962/InjectionNext#147 · 1 条评论 ·
-
Issue injecting on real device – Code signature invalid & Unhide Symbols restart loop可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 4/5 3-5 天 新手友好度 38/100
johnno1962/InjectionNext#81 · 18 条评论 · 2 个 reaction ·
查看 johnno1962/InjectionNext 的全部 Issue
相似的 Issue
-
area:ui enhancement good first issue
难度 2/5 1-3 小时 新手友好度 72/100
s3onghyun/bulchimbeon#22 ·
-
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
[BUG] File transcription skips audio chunks shorter than one second可能已有人在做 @sabbah13 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
altic-dev/FluidVoice#1161 ·
维护者通常 1 天内回复
-
swift.md: `Date(myString, strategy: .iso8601)` example omits `try` — the initializer is throwing未关闭
难度 1/5 1 小时以内 新手友好度 88/100