Please provide an auth token with USYM_UPLOAD_AUTH_TOKEN environment Unity Mac 命令行出包报错
Unity有些版本的bug,因?yàn)槭裁碈loud build。這幾天更新Unity版本后jenkins無(wú)法自動(dòng)打IOS IPA,報(bào)錯(cuò)內(nèi)容為:
Please provide an auth token with USYM_UPLOAD_AUTH_TOKEN environment
Google一大波,才找到解決方案:填寫(xiě)個(gè)假的token?
https://forum.unity.com/threads/ios-build-is-failing-seems-like-a-fastlane-problem-not-sure-how-to-proceed.682201/#post-4701557
?但是用了google廣告插件的童鞋們要注意了,上邊的解決方案還不夠,還得修改Project以及其他Target中的property,設(shè)置假的Token。把下邊的代碼放入U(xiǎn)nity 項(xiàng)目中的Editor中,可以解決問(wèn)題。蛋疼的Unity,搞毛線啊。。。。一個(gè)什么鬼Cloud build我們也不用,還要讓我們頭禿一波
#if UNITY_IOSusing UnityEditor; using UnityEditor.Build; using UnityEditor.Build.Reporting; using UnityEditor.iOS.Xcode; using UnityEngine;/// <summary> /// Adding fake USYM_UPLOAD_AUTH_TOKEN if not already set, to avoid cli build errors /// see https://forum.unity.com/threads/ios-build-is-failing-seems-like-a-fastlane-problem-not-sure-how-to-proceed.682201/#post-4701557 /// </summary> public class AddFakeUploadTokenPostprocessor : IPostprocessBuildWithReport {public int callbackOrder => 100;public void OnPostprocessBuild(BuildReport report){var pathToBuiltProject = report.summary.outputPath;var target = report.summary.platform;if (target != BuildTarget.iOS){return;}Debug.LogFormat("Postprocessing build at \"{0}\" for target {1}", pathToBuiltProject, target);PBXProject project = new PBXProject();string pbxFilename = pathToBuiltProject + "/Unity-iPhone.xcodeproj/project.pbxproj";// string pbxFilename = pathToBuiltProject + "/Unity-iPhone.xcodeproj/project.wcworkspace";//string pbxFilename = pathToBuiltProject + "/Unity-iPhone.xcworkspace/project.pbxproj";project.ReadFromFile(pbxFilename);#if UNITY_2019_3_OR_NEWERstring targetGUID = project.GetUnityMainTargetGuid();//project.target#elsestring targetName = PBXProject.GetUnityTargetName();string targetGUID = project.TargetGuidByName(targetName);#endifvar token = project.GetBuildPropertyForAnyConfig(targetGUID, "USYM_UPLOAD_AUTH_TOKEN");if (string.IsNullOrEmpty(token)){token = "FakeToken";}string targetGUID2 = project.TargetGuidByName("UnityFramework");project.SetBuildProperty(targetGUID, "USYM_UPLOAD_AUTH_TOKEN", token);project.SetBuildProperty(targetGUID2, "USYM_UPLOAD_AUTH_TOKEN", token);project.SetBuildProperty(project.ProjectGuid(), "USYM_UPLOAD_AUTH_TOKEN", token); //project.SetBuildPropertyForConfig();project.WriteToFile(pbxFilename);} }#endif?
總結(jié)
以上是生活随笔為你收集整理的Please provide an auth token with USYM_UPLOAD_AUTH_TOKEN environment Unity Mac 命令行出包报错的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 战舰世界洛阳号全面评测及进阶技巧 洛阳号
- 下一篇: 图形学教程Lecture 13: Ray