C# 在unity上压缩字符串时,libMonoPosixHelper.dylib出现问题

C# 在unity上压缩字符串时,libMonoPosixHelper.dylib出现问题,c#,.net,unity3d,compression,C#,.net,Unity3d,Compression,我又在一个旧项目上工作,该项目过去与Unity 2018一起构建并运行良好。3 我已经安装了Unity 2019.3.0f3 我可以毫无问题地构建(除非我在某个地方的日志中遗漏了什么?) 我有以下功能: public static string CompressString(string text) { try { if (text == null || text.Length == 0) retur

我又在一个旧项目上工作,该项目过去与Unity 2018一起构建并运行良好。3

我已经安装了Unity 2019.3.0f3

我可以毫无问题地构建(除非我在某个地方的日志中遗漏了什么?)

我有以下功能:

public static string CompressString(string text)
        {
            try
            {
                if (text == null || text.Length == 0) return String.Empty;

                using (var memoryStream = new MemoryStream())
                {
                    byte[] buffer = Encoding.UTF8.GetBytes(text);
                    using (var gZipStream = new GZipStream(memoryStream, CompressionMode.Compress, true))
                    {
                        gZipStream.Write(buffer, 0, buffer.Length);
                    }

                    memoryStream.Position = 0;

                    var compressedData = new byte[memoryStream.Length];
                    memoryStream.Read(compressedData, 0, compressedData.Length);

                    var gZipBuffer = new byte[compressedData.Length + 4];
                    Buffer.BlockCopy(compressedData, 0, gZipBuffer, 4, compressedData.Length);
                    Buffer.BlockCopy(BitConverter.GetBytes(buffer.Length), 0, gZipBuffer, 0, 4);

                    return Convert.ToBase64String(gZipBuffer);
                }
            }
            catch (Exception erreur)
            {
                return text;
            }
        }
这在windows上运行良好

当我在mac上试用时,会出现以下异常:

压缩字符串:libMonoPosixHelper.dylib:::at(包装器 管理到本地) System.IO.Compression.DeflatestStreamNative.CreateZStream(System.IO.Compression.CompressionMode,bool,System.IO.Compression.DeflatestStreamNative/UnmanagedOrWrite,intptr) 在System.IO.Compression.DeflateStreamNative.Create(System.IO.Stream 压缩流,System.IO.Compression.Compression模式, System.Boolean gzip)[0x0004a]位于:0 在System.IO.Compression.DeflatestStream..ctor(System.IO.Stream 压缩流,System.IO.Compression.Compression模式, System.Boolean打开,System.Boolean gzip)[0x0002d]在 :0 at System.IO.Compression.DeflatestStream..ctor(System.IO.Stream, System.IO.Compression.CompressionMode模式,System.Open, System.Int32 windowsBits)[0x00000]英寸 :0 at(包装器) 远程处理(通过检查调用) System.IO.Compression.DeflateStream..ctor(System.IO.Stream,System.IO.Compression.CompressionMode,bool,int) 在System.IO.Compression.GZipStream..ctor(System.IO.Stream, System.IO.Compression.CompressionMode模式,System.O(打开) [0x00006]英寸:0英寸(包装器 远程处理(通过检查调用) System.IO.Compression.GZipStream..ctor(System.IO.Stream,System.IO.Compression.CompressionMode,bool) 在libtransversal.Helper.String_Utils.CompressString(System.String)处 0中的文本)[0x00028] DebugLogHandler:Internal_Log(LogType,LogOption,String, DebugLogHandler:LogFormat(日志类型、对象、字符串、, 对象[])UnityEngine.Logger:日志(日志类型,对象) 调试:日志错误(对象) libtransversal.Helper.Monitoring:异常(异常,字符串) libtransversal.Helper.String_Utils:压缩字符串(字符串)。。。 System.Threading.ThreadHelper:ThreadStart\u上下文(对象) System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback,对象,布尔值) System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback,对象,布尔值) System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback,对象) System.Threading.ThreadHelper:ThreadStart(对象)(文件名: ./Runtime/Export/Debug/Debug.bindings.h行:35)

我错过什么了吗?这是Unity的问题还是我在使用mac上不可用的功能?

的“当我在mac上尝试时”是指在mac上的编辑器中运行项目时,在mac上尝试构建时,还是在mac上运行构建应用程序时?我指的是构建(从我的pc上构建mac)并在mac上启动构建。