Apple.Core appends a second CODE_SIGN_ENTITLEMENTS value instead of reusing the existing entitlements file
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 65/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- csharp
- 領域
- build-system
研究方向
Start in AppleBuild.OnPostProcessBuild and trace how the project reads and writes CODE_SIGN_ENTITLEMENTS for iOS, tvOS, and visionOS. Reproduce with the notification package setup described in the issue, then check that Apple.Core uses one entitlements file per target and that Xcode builds successfully.
由索引模型根據 Issue 內容生成。
描述
Describe the bug
On iOS and tvOS builds, AppleBuild.OnPostProcessBuild always writes its entitlements to <Product Name>.entitlements and adds that name to CODE_SIGN_ENTITLEMENTS with PBXProject.AddBuildProperty. It never checks what CODE_SIGN_ENTITLEMENTS already points to.
Unity's notification packages (com.unity.services.push-notifications, com.unity.mobile.notifications) run before Apple.Core's [PostProcessBuild(10)]. They read CODE_SIGN_ENTITLEMENTS first and, when it's empty, name the file after the last part of the bundle identifier. So whenever Product Name differs from that part, the project gets two entitlements files and CODE_SIGN_ENTITLEMENTS holds both names. Xcode then fails with an error naming a single file made of both names, for example ExampleGame.entitlements Example Game.entitlements.
The same happens without those packages when building into an existing Xcode project (Append) after changing Product Name: the old name stays and the new one is added next to it.
To Reproduce
- iOS project with Apple.Core and
com.unity.services.push-notifications(orcom.unity.mobile.notificationswith push enabled). - Product Name "Example Game", bundle identifier
com.example.ExampleGame. - Build for iOS into an empty folder, then build the generated Xcode project.
Expected behavior
One entitlements file per target. If CODE_SIGN_ENTITLEMENTS is already set, Apple.Core should merge its keys into that file, create a file only when none is set, and use SetBuildProperty so the setting never holds two values.
Environment
Unity 6000.6, iOS (tvOS and visionOS go through the same code). Seen with Apple.Core 3.2.0; the code is unchanged in 3.3.0 (27.0, ffe6174) and on main (96e4a04).
Additional context
Sketch of the fix in OnPostProcessBuild:
var targetGuid = pbxProject.GetUnityMainTargetGuid();
var entitlementsFileName = pbxProject.GetBuildPropertyForAnyConfig(targetGuid, "CODE_SIGN_ENTITLEMENTS");
if (string.IsNullOrEmpty(entitlementsFileName))
{
var bundleIdentifier = PlayerSettings.GetApplicationIdentifier(NamedBuildTarget.FromBuildTargetGroup(BuildPipeline.GetBuildTargetGroup(buildTarget)));
entitlementsFileName = $"{bundleIdentifier.Substring(bundleIdentifier.LastIndexOf('.') + 1)}.entitlements";
}
// read, merge and write {generatedProjectPath}/{entitlementsFileName}, then:
pbxProject.SetBuildProperty(targetGuid, "CODE_SIGN_ENTITLEMENTS", entitlementsFileName);
Related: #37 switches the file lookup to GetEntitlementFilePathForTarget but keeps AddBuildProperty with the Product Name path, so the setting still gets a second value. Our embedded copy uses the bundle-identifier name plus SetBuildProperty for iOS, tvOS and visionOS, which fixes it for us.
- 主要語言
- C#
- 星號
- 1k
- 分支
- 257
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
apple/unityplugins 的其他 Issue
-
bug Plug-in - GameKit Plugin-in - Core
難度 4/5 3-5 天 新手友好度 55/100
apple/unityplugins#133 · 已指派 1 人 ·
-
bug Plugin-in - Core
難度 4/5 3-5 天 新手友好度 55/100
apple/unityplugins#132 ·
-
bug Plugin-in - Core
難度 4/5 3-5 天 新手友好度 55/100
apple/unityplugins#125 · 2 則留言 ·
-
Crash Issue On macOS 27 With Game Kit可能已有人在做 @ryzngard 於 40 天前認領。 未關閉bug Plug-in - GameKit
難度 4/5 3-5 天 新手友好度 35/100
apple/unityplugins#124 · 已指派 1 人 ·
-
Arguments for Push Message localisation in SendExchange do not seem to work可能重新可做 @ryzngard 於 169 天前認領,目前沒有進行中的 PR。 未關閉bug Plug-in - GameKit
apple/unityplugins#98 · 2 則留言 · 已指派 1 人 ·
查看 apple/unityplugins 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 75/100
維護者通常 1 天內回覆
-
area-ai untriaged
難度 2/5 1-3 小時 新手友好度 78/100
dotnet/extensions#7956 ·
維護者通常 1 天內回覆
-
bug needs-triage
難度 2/5 1-3 小時 新手友好度 67/100
microsoft/microsoft-ui-reactor#1567 ·
維護者通常 1 天內回覆
-
priority:p2
難度 2/5 1-3 小時 新手友好度 82/100
QuantConnect/Lean#10191 · 1 則留言 ·
維護者通常 1 天內回覆
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P2
難度 2/5 1-3 小時 新手友好度 76/100
openclaw/openclaw-windows-node#2287 · 2 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆