Search Issue Tracker

By Design

Votes

0

Found in

2018.4

2019.2.17f1

2020.2

Issue ID

1230961

Regression

No

Xcode project Capabilies and entitlements.ppcw not being added when using PBXProject.WriteToFile() & PlistDocument.WriteToFile()

Build Pipeline

-

Reproduction steps:
1. Open user's attached project in "SetBackgroundModesIssue.zip"
2. "PostBuild.cs" has OnPostProcessBuild function and lines 53, 54 cause the issue
3. Switch the platform to iOS and build the project (check note 2)
4. Open the .xcodeproj created and check Capabilities and files included

Expected result: project Capabilities (in Signing and Capabilities) and entitlements.ppcw (in the file browser of Xcode) will be included
Actual result: entitlements.ppcw and Capabilities are not included

Reproducible with: 2018.4.20f1, 2020.2.0a5
Could not test with 2017.4 because of errors in the console

Could not test with the tvOS platform (I did test it, but the Capabilities added were unrelated to the ones in the Script. Entitlements.ppcw was added, but I do not believe this qualifies as tested yet since I do not know how exactly the Script affects tvOS build in comparison to iOS build)

Notes:
1. Commenting only one line: either 53 or 54 produces different results (one Capability included or entitlements.ppcw included but no Capabilities included)
2. Building in newer Unity versions will require you to change line 35 in PostBuild.cs to: "targetName = PBXProject.GetUnityTestTargetName();" as GetUnityTargetName is deprecated (occured in 2020.2)
3. Capabilities that should be added are: AddSignInWithApple and AddBackgroundModules
4. In 2020.2 only one Capability (AddBackGroundModules) is added even if both line 53 and 54 are commented

  1. Resolution Note (2020.2.X):

    ProjectCapabilityManager assumes ownership of xcodeproj and plist, namely it will read them from files, update, and write back
    in the repro project, after this is done, xcodeproj and plist are overwritten from the instances holding old data (both PBXProject and PlistDocument reads data at once and do not reread file afterwards)

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.