Search Issue Tracker

In Progress

Under Consideration for 2021.3.X, 2022.3.X, 6000.0.X

In Progress in 6000.1.X

Votes

0

Found in

2021.3.46f1

2022.3.53f1

6000.0.28f1

6000.1.0a5

Issue ID

UUM-87502

Regression

No

[iOS] Command-line build of exported iOS project fails in provisioning roughly 50% of the time

--

-

*Steps to reproduce:*

*1.* Download “batchmode.zip” project, expand it but do not open with any unity version

*2.* Open Terminal window in the project folder

*3.* Run command:
{code:java}
/Applications/Unity/<unity version>/Unity.app/Contents/MacOS/Unity -quit -batchmode -projectPath /<path to project>/batchMode -executeMethod MyEditorScript.PerformIOSBuild{code}
*4.* When Xcode project is created, move "build.xml" file inside the Xcode project

*5.* Open terminal window inside the Xcode project window

*6.* Open "build.xml" file and adjust all values below to paths appropriate for your setup:
* xcodeBuildPath" value="${basedir}"/>
* <property name="xcodeProject" value="${xcodeBuildPath}/Unity-iPhone.xcodeproj"/>
* <property name="appName" value="AppName"/>
* <property name="placeholderProcessSymbolsSh" value="$/path/to/your/placeholder_process_symbols.sh"/>
* <property name="keychainPath" value="/path/to/your/custom.keychain-db"/>
* <property name="keychainPassword" value="your-keychain-password"/>
* <property name="certificatePath" value="/path/to/your/certificate.p12"/>
* <property name="certificatePassword" value="your-certificate-password”/>

*7.* In terminal enter command:
{code:java}
ant -f build.xml{code}
(this script changes everything form Unity-iPhone, to a custom name - AppName)

*8.* Open new terminal window and enter these commands to unlock the custom keychain and force re-import the correct certificate with the right app permissions
* /usr/bin/security unlock-keychain -p "${KEYCHAIN_PASSWORD}" "AppNameBuild.keychain"
* /usr/bin/security set keychain-settings -u -t 7200 "AppNameBuild.keychain"
* usr/bin/security import /<path to where your certificate is>/Development-Certificate.p12 -k AppNameBuild.keychain -t cert -f pkcs12 -P "${KEYCHAIN_PASSWORD}" -T /usr/bin/codesign -T /usr/bin/xcrun -T /usr/bin/xcodebuild
* /usr/bin/security set-key-partition -S "apple:,apple-tool:,codesign:" -s -k "${KEYCHAIN_PASSWORD}" "AppNameBuild.keychain"

*9.* Next run command bellow, to archive Xcode project
* /usr/bin/xcodebuild -project /<path to your xcodeproj>/AppName.xcodeproj -scheme "AppName" OTHER_CODE_SIGN_FLAGS="'-keychain=AppNameBuild.keychain'" archive -archivePath "iOSBuild/AppName.xcarchive" CODE_SIGN_IDENTITIY="${SIGNING_CERTIFICATE_SHA}"

 

*Expected:* Archive is successful

*Actual:* Archiving fails with error:
{code:java}
error: "Unity-iPhone" requires a provisioning profile. Select a provisioning profile in the Signing & Capabilities editor. (in target 'Unity-iPhone' from project 'AppName'){code}
 

*Reproducible with versions:* 2021.3.45f1, 2022.3.18f1, 2022.3.45f1, 2022.3.53f1, 6000.0.28f1, 6000.1.0a5

*Possible regression:* 2022.3.18f1 (user reported that this issue is not reproducible with this version, but I still reproduce this issue here)

*Tested with:* MacBook Pro, Apple M1 Max, OS: Sequoia 15.1, Xcode 16.0 

 

Note:
* If iOS build fails,open the project with wanted Editor version, clear all errors if there are any. Then close project and delete Library folder

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.