Reputation: 672
When i load a html on UIWebView
in ios8
app is crashing.
Second time when i open the page again it not crashing , it happens only in IOS 8.
On ViewWillAppear
calling 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
function gotoInternalHref(posIndex) {
LocationHash = "#" + posIndex;
positionindex = posIndex;
window.location.hash = LocationHash;
}
Please help me to fix this issue.
Thanks in advance.
Upvotes: 0
Views: 709
Reputation: 672
Finally i found the problem. In my html i am using embed tag because of this it is crashing.
<embed width ="600" height ="400" src="01.jpg" href="01.mp4" type="video/mp4" id="video-01"target ="myself" scale="1"/>
Changed to
<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>
it's working :) Thanks a lot.
Upvotes: 2