Apple.Core appends a second CODE_SIGN_ENTITLEMENTS value instead of reusing the existing entitlements file
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 65/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- csharp
- Domaine
- build-system
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- C#
- Étoiles
- 1k
- Forks
- 257
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de apple/unityplugins
-
bug Plug-in - GameKit Plugin-in - Core
Difficulté 4/5 3-5 jours Accessibilité débutants 55/100
apple/unityplugins#133 · 1 personne assignée ·
-
bug Plugin-in - Core
Difficulté 4/5 3-5 jours Accessibilité débutants 55/100
apple/unityplugins#132 ·
-
bug Plugin-in - Core
Difficulté 4/5 3-5 jours Accessibilité débutants 55/100
apple/unityplugins#125 · 2 commentaires ·
-
Crash Issue On macOS 27 With Game KitPeut-être pris @ryzngard l’a pris il y a 40 jours. Ouvertebug Plug-in - GameKit
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
apple/unityplugins#124 · 1 personne assignée ·
-
Arguments for Push Message localisation in SendExchange do not seem to workPeut-être à nouveau libre @ryzngard l’a pris il y a 169 jours, et aucune pull request n’est ouverte. Ouvertebug Plug-in - GameKit
apple/unityplugins#98 · 2 commentaires · 1 personne assignée ·
Toutes les issues de apple/unityplugins
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
Les mainteneurs répondent en général sous 1 jour
-
area-ai untriaged
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
dotnet/extensions#7956 ·
Les mainteneurs répondent en général sous 1 jour
-
bug needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 67/100
microsoft/microsoft-ui-reactor#1567 ·
Les mainteneurs répondent en général sous 1 jour
-
priority:p2
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
QuantConnect/Lean#10191 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P2
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
openclaw/openclaw-windows-node#2287 · 2 commentaires · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour