ios 8 时 UIWebView 崩溃

UIWebView crash on ios 8

当我在 ios8 中的 UIWebView 上加载 html 时,应用程序崩溃了。 第二次当我再次打开页面时它没有崩溃,它只发生在 IOS 8.

ViewWillAppear 调用 openLink

-(void)openLink{
NSString *pathFile = [[NSBundle mainBundle] pathForResource:filePath ofType:@"html"];
NSURL *url = [NSURL fileURLWithPath:pathFile ];     
NSString *urlwithoutQueryString = [url absoluteString];
NSString * urlWithQueryString = [NSString stringWithFormat:@"%@?%@",urlwithoutQueryString, filePathAnchor];
NSURL *url2 = [NSURL URLWithString:urlWithQueryString];
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:url2];

if ([webView request] != urlRequest){
    [webView loadRequest:urlRequest];
}
NSString *str =[NSString stringWithFormat:@"javascript:gotoInternalHref('0000');"];
[webView stringByEvaluatingJavaScriptFromString:str];
}

Javascript函数

function gotoInternalHref(posIndex) {
LocationHash = "#" + posIndex;
positionindex = posIndex;

window.location.hash = LocationHash;
}

请帮我解决这个问题。

提前致谢。

终于找到问题了。在我的 html 中,我正在使用嵌入标签,因为它正在崩溃。

<embed width ="600" height ="400" src="01.jpg" href="01.mp4" type="video/mp4"  id="video-01"target ="myself" scale="1"/>

改为

<video controls="controls" autoplay="autoplay" loop width="600" height="400" poster="01.jpg" id="video-01" target="myself" scale="1">
    <source src="01.mp4" type="video/mp4">
</video>

它正在工作:) 非常感谢。