SVG 无法在 iOS 中加载

Raj*_*hra 5 svg ios swift

我有一些 SVG 文件无法在 iOS 中加载。(Swift 5,Xcode 13.2.1)这是其中一个 SVG: https: //svgshare.com/i/dWy.svg

我尝试过以下替代方案:

  1. 我正在使用SDWebImageSVGKitPlugin库从服务器加载 SVG。我从图书馆得到的错误是:
"Downloaded image decode failed" 
UserInfo={
  NSLocalizedDescription=Downloaded image decode failed
}
Run Code Online (Sandbox Code Playgroud)
  1. 我尝试下面的代码直接从服务器以数据格式下载图像并将其转换为 UIImage:
if let url = URL(string: "https://svgshare.com/i/dWy.svg") {
    do {
        let imageData = try Data(contentsOf: url)
        if let image = UIImage(data: imageData) {
            print(image)
        }
    } catch {
        print("Error downloading image: \(error)")
    }
}
Run Code Online (Sandbox Code Playgroud)
  1. 我尝试了SwiftSVG库,但 SVG 图像未加载,并且控制台中也没有错误。

观察:
发生的一件奇怪的事情是,如果我从服务器下载 SVG,将其添加到Assets.xcassets文件夹中的项目中,则该特定 SVG 已正确加载,但从服务器接收时它没有被加载。

任何帮助将不胜感激。
另外,如果需要任何其他信息,请告诉我。提前致谢!