I've got a simple UIWebView in my iPhone app that's loading a XHTML document with some SGV embeded. This all works find on the desktop version of Safari, but it crashes in a UIWebView.
Here is the Objective C:
NSString *path = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"html"];
NSData *fileData = [NSData dataWithContentsOfFile: path];
[svgView loadData: fileData MIMEType: @"text/xml" textEncodingName: @"UTF-8" baseURL: [NSURL fileURLWithPath: path]];
I also tried a MIMEType of application/xhtml+xml, but it didn't help.
Here is the HTML:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XTech SVG Demo</title>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg">
<g style="fill-opacity:0.7;">
<circle cx="6.5cm" cy="2cm" r="100" style="fill:red; stroke:black; stroke-width:0.1cm" transform="translate(0,50)" />
<circle cx="6.5cm" cy="2cm" r="100" style="fill:blue; stroke:black; stroke-width:0.1cm" transform="translate(70,150)" />
<circle cx="6.5cm" cy="2cm" r="100" style="fill:green; stroke:black; stroke-width:0.1cm" transform="translate(-70,150)"/>
</g>
</svg>
</body>
</html>
All very basic stuff. When it loads on the iPhone, however, it crashes with this error:
2010-03-31 10:37:10.252 ColorDoodle[2014:20b] -[DOMElement structuralComplexityContribution]: unrecognized selector sent to instance 0x3e51b60 2010-03-31 10:37:10.253 ColorDoodle[2014:20b] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' -[DOMElement structuralComplexityContribution]: unrecognized selector sent to instance 0x3e51b60'
Any idea why? Is this a bug in the rendering engine of the UIWebView? I don't see anything too odd here.
* Updated *
There is definitely something screwy going on here.
If I add this bit of code just inside the tag, it works fine:
<form>
</form>
Take that code back out, and it crashes again.