I recently worked on an svg map application. everything works fine on ios7. when i transfer my project to ios8. strange things happened, I found that when a UIWebview reads a local html file into which the svg file is embedded, the svg file will not display on ios8.
code example:
@implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; NSString *path = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"html"]; NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:path]; NSURLRequest *req = [NSURLRequest requestWithURL:fileURL]; [self.webView loadRequest:req]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } @end
and the html file used:
<!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8"> <title>SVG DEMO</title> </head> <body> <div> <embed src="410.svg" width="64" height="64" type="image/svg+xml" /> <object type="image/svg+xml" data="410.svg" width="64" height="64" border="1"></object> </div> </body> </html>
Does anyone know what is going on?
thanks
source share