OGeek|极客世界-中国程序员成长平台

标题: c# - iOS 上的 Ionic.Zip.Unity.dll ZlibException [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 01:10
标题: c# - iOS 上的 Ionic.Zip.Unity.dll ZlibException

我正在使用 Unity 开发适用于 Android 和 iOS 的手机游戏。 在我的游戏中,我需要下载一个压缩文件并解压。

为了管理压缩和解压缩,我使用了 Ionic.Zip.Unity(您可以在 https://github.com/r2d2rigo/dotnetzip-for-unity 找到该库)。 Ionic.Zip 是 DotNetZip 库的精简版,应该适用于 Android 和 iOS。

所以,我的代码是:

string fileStr = "*************";
byte[] fileData = Convert.FromBase64String(fileStr);

MemoryStream fileStream = new MemoryStream(fileData);

ZipFile zipFile = ZipFile.Read(fileStream);
foreach (ZipEntry zipEntry in zipFile)
{
     MemoryStream memoryStream = new MemoryStream();

     zipEntry.Extract(memoryStream);

     memoryStream.position = 0;
     StreamReader streamReader = new StreamReader(memoryStream);
     string str = streamReader.ReadToEnd();

     Debug.Log("String decoded: " + str);
}

*fileStr 包含加密字符串。

此代码适用于所有平台(Android、PC、iOS)的编辑器。 如果我为 Android 构建 apk,它可以工作。 问题出在 iOS 版本上。代码编译但运行时我有这个异常:

ZlibException 膨胀:rc=323508496 msg=

我尝试删除 .dll 并将源代码添加到项目中,它可以工作。怎么可能?

我真的需要帮助,因为我完成了我的想法。

谢谢大家。



Best Answer-推荐答案


我在使用 BestHTTP 时遇到了同样的问题(它在后台也使用了 Zlib)。我花了将近两天的时间才发现它肯定与特定的 UnityXcode 版本有关,不能正常工作。

问题出现在 Unity 5.5.0f3Unity 5.6.0f1 上,使用 Xcode 8.3 但没有出现使用 Xcode 8.2.1

我会做进一步调查并检查它是否适用于较新的 Unity 版本。并随时为您提供最新信息。


更新:

似乎是 Unity 中的一个错误,应该在不久的将来解决。

Fix in review

https://issuetracker.unity3d.com/issues/il2cpp-xcode-ios-xcode-3-throw-error-when-played-xcode-8-dot-2-1-does-not

关于c# - iOS 上的 Ionic.Zip.Unity.dll ZlibException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43590667/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4