我最近正在开发一个svg地图应用程序.在ios7上一切正常.当我将我的项目移动到ios8时.奇怪的事情发生了,我发现当UIWebview读取嵌入了svg文件的本地html文件时,svg文件将不会显示在ios8上.
示例代码在这里:
@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
Run Code Online (Sandbox Code Playgroud)
和使用的html文件:
<!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>
Run Code Online (Sandbox Code Playgroud)
有谁知道发生了什么?
谢谢