pocketsvg/PocketSVG

Assertion failure in hexTriplet

smhk opened this issue · 8 comments

smhk commented

unfortunately I got a

Assertion failure in hexTriplet::hexTriplet(NSString *__strong)(), /Users/jpm/Desktop/PocketSVG-master/SVGEngine.mm:888

that's in
hexTriplet::hexTriplet(NSString *str)
...
NSCParameterAssert([str hasPrefix:@"#"]);

Could be due to a gradient? Bummer...

Could you please provide steps to reproduce this?

smhk commented

thanks @arielelkin

So, the tiger.svg file works perfectly

@IBOutlet var svgTest: UIView!


	let u = Bundle.main.url(forResource: "tiger", withExtension: "svg")!
	let s = SVGImageView.init(contentsOf: u)
	s.contentMode = .scaleAspectFit
	svgTest.addSubview(s)
	s.bindEdgesToSuperview() // (adds 4 constraints)

on a device:

Screen Shot 2019-07-27 at 2 54 10 PM

Now, simply change to the file "test.svg"

Doesn't work:

  2019-07-27 14:58:08.855049-0500 JMetal[4951:3687488] *** Assertion failure in 
  hexTriplet::hexTriplet(NSString *__strong)(), /Users/jpm/Desktop/PocketSVG-
  master/SVGEngine.mm:888

Here's the file test.svg

test.svg.zip

It's basically "a blue dot", 2048.2048

Any ideas appreciated! PocketSVG is wonderful.

smhk commented

@arielelkin , thanks, there's the test file. I have found another one that throws the same error (it;'s a corporate logo, I could email it if you wish)

not sure what the issue could be! the TIGER does indeed have gradients so I guess that is not the problem as such.

Thanks for sending this through. I suspect it's because the colours are expressed as RGB values rather than hex. Can you try this format:fill="#cc7226" rather than rgb(0, 38, 245)

Closing as I haven't heard back, but feel free to reopen if the problem persists.

smhk commented

Sorry, so busy, will get to it !!!!!!!!

Hi I have some strange crash
*** Assertion failure in hexTriplet::hexTriplet(NSString *__strong)(), SVGEngine.mm:904

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: [str hasPrefix:@"#"]'

this is probably due to a colour being expressed as an RGB value rather than hex.