-7

I get that error when I tried to use svg image:

https://bomobikids.takiacademy.me/uploads/images/imagesApi/62ed3f8eec557218869870.svg

Thread 8: "Cannot determine the PPI values for current device; returning 0.0f - hopefully this will crash your code (you CANNOT run SVG's that use CM/IN/MM etc until you fix this)" libc++abi: terminating with uncaught exception of type NSException

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Cannot determine the PPI values for current device; returning 0.0f - hopefully this will crash your code (you CANNOT run SVG's that use CM/IN/MM etc until you fix this)'

terminating with uncaught exception of type NSException

SVGImageView(url: URL(string: "https://bomobikids.takiacademy.me/uploads/images/imagesApi/62ed3f8eec557218869870.svg") ?? URL(fileURLWithPath: ""), size: size)


struct SVGImageView: UIViewRepresentable {
    var url: URL
    var size: CGSize?

    func updateUIView(_ uiView: SVGKFastImageView, context: Context) {
        uiView.contentMode = .scaleAspectFit
        uiView.image.size = size ?? CGSize(width: 100, height: 100)
    }

    func makeUIView(context: Context) -> SVGKFastImageView {
        let svgImage = SVGKImage(contentsOf: url)
        return SVGKFastImageView(svgkImage: svgImage ?? SVGKImage())
    }
}

I tried to use another image like it. It always works on the first time but when I run the app again the error is back

DonMag
  • 69,424
  • 5
  • 50
  • 86
  • i guess the error is thrown there https://github.com/SVGKit/SVGKit/blob/3.x/Source/DOM%20classes/SVG-DOM/SVGLength.m so the lasts specifics iPhone supported are iPhone 7 & iPhone 7Plus but you should enter still `[platform hasPrefix:@"iPhone"]` (no specific model), what's your platform on your tests? – Larme Aug 29 '23 at 14:33
  • This might be related: https://stackoverflow.com/questions/36618965/how-to-find-ppi-programmatically-with-precision – ccprog Aug 29 '23 at 17:31

0 Answers0