You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Unity云构建iOS报错:SDK不含libarclite,求解决方法

Unity Cloud构建iOS时libarclite缺失问题解决方法

针对你遇到的Xcode 15构建时找不到libarclite的问题,核心原因是Xcode 15移除了对iOS 14.0以下系统的libarclite支持,但即使你在Unity Player Settings中设置了最低部署目标为14.0,仍可能存在第三方依赖或自动生成的Xcode项目子Target未同步该配置的情况。以下是适配Unity Cloud构建环境的具体解决方案:


1. 用Unity预构建脚本强制统一所有Xcode Target的部署目标

Unity Cloud构建无法直接操作Xcode界面,可通过Editor脚本在生成Xcode项目后自动修改所有Target的配置:

在项目的Assets/Editor目录下创建如下C#脚本:

using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
using System.IO;

public class iOSPostBuildConfig
{
    [PostProcessBuild(999)]
    public static void OnPostProcessBuild(BuildTarget buildTarget, string buildPath)
    {
        if (buildTarget != BuildTarget.iOS) return;

        string projPath = Path.Combine(buildPath, "Unity-iPhone.xcodeproj/project.pbxproj");
        PBXProject pbxProj = new PBXProject();
        pbxProj.ReadFromString(File.ReadAllText(projPath));

        // 获取主Target、Framework Target及所有第三方Target的GUID
        string mainTarget = pbxProj.GetUnityMainTargetGuid();
        string frameworkTarget = pbxProj.GetUnityFrameworkTargetGuid();
        
        // 统一设置部署目标为14.0
        SetDeploymentTarget(pbxProj, mainTarget, "14.0");
        SetDeploymentTarget(pbxProj, frameworkTarget, "14.0");
        
        // 遍历所有Target,强制同步配置
        foreach (string targetGuid in pbxProj.TargetsGuidList())
        {
            SetDeploymentTarget(pbxProj, targetGuid, "14.0");
        }

        File.WriteAllText(projPath, pbxProj.WriteToString());
    }

    private static void SetDeploymentTarget(PBXProject pbxProj, string targetGuid, string version)
    {
        pbxProj.SetBuildProperty(targetGuid, "IPHONEOS_DEPLOYMENT_TARGET", version);
        // 确保启用模块编译,避免额外兼容性问题
        pbxProj.SetBuildProperty(targetGuid, "CLANG_ENABLE_MODULES", "YES");
    }
}

该脚本会在Unity生成Xcode项目后自动执行,将所有Target的最低部署目标强制设为14.0,覆盖第三方依赖的自定义配置。


2. 配置Unity Cloud构建参数

在Unity Cloud的构建配置页面:

  • 确认iOS平台设置中的Xcode Version选择为15.2(与报错中的路径版本一致)
  • 在Advanced Options的Additional Build Arguments中添加:
    -executeMethod iOSPostBuildConfig.OnPostProcessBuild
    
    确保预构建脚本被Cloud构建流程调用。

3. 排查第三方依赖兼容性

  • 检查项目中所有第三方插件/SDK的版本,更新至支持iOS 14.0+的最新版本(部分旧插件可能硬编码了低于14.0的部署目标)
  • 若使用自定义Native插件,检查插件内的.xcconfig或pbxproj片段,删除任何设置IPHONEOS_DEPLOYMENT_TARGET低于14.0的配置

4. 自定义Fastlane构建配置(可选)

若Unity Cloud使用Fastlane执行构建(报错中出现bvr和fastlane路径),可在Fastfile中添加强制修改配置的逻辑:

lane :unity_ios_build do
  # 修改主Target和Framework Target的部署目标
  update_xcode_build_settings(
    xcodeproj: "Unity-iPhone.xcodeproj",
    build_settings: { "IPHONEOS_DEPLOYMENT_TARGET" => "14.0" },
    target: "Unity-iPhone"
  )
  update_xcode_build_settings(
    xcodeproj: "Unity-iPhone.xcodeproj",
    build_settings: { "IPHONEOS_DEPLOYMENT_TARGET" => "14.0" },
    target: "UnityFramework"
  )

  # 执行构建
  gym(
    scheme: "Unity-iPhone",
    destination: "generic/platform=iOS",
    export_method: "app-store"
  )
end

将自定义Fastfile上传至Unity Cloud构建配置的对应目录,替换默认构建脚本。

内容的提问来源于stack exchange,提问作者Karol Hetman

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.16 03:35:05