我使用Cordova CLI创建了一个Phonegap项目,我的index.html页面包含要使用KRPano观看的360VR图像。 一切都运行良好,但有时,页面会自动重新加载。调试器显示CDVWebViewDelegate.m中的此方法被连续调用
- (void)webViewDidFinishLoad:(UIWebView*)webView
{
VerboseLog(@"webView didFinishLoad (before). state=%d loadCount=%d", _state, _loadCount);
BOOL fireCallback = NO;
switch (_state) {
case STATE_IDLE:
break;
case STATE_WAITING_FOR_LOAD_START:
NSLog(@"CDVWebViewDelegate: Unexpected didFinish while waiting for load start.");
break;
case STATE_WAITING_FOR_LOAD_FINISH:
if (_loadCount == 1) {
fireCallback = YES;
_state = STATE_IDLE;
}
_loadCount -= 1;
break;
case STATE_IOS5_POLLING_FOR_LOAD_START:
[self pollForPageLoadStart:webView];
break;
case STATE_IOS5_POLLING_FOR_LOAD_FINISH:
[self pollForPageLoadFinish:webView];
break;
}
VerboseLog(@"webView didFinishLoad (after). state=%d loadCount=%d fireCallback=%d", _state, _loadCount, fireCallback);
if (fireCallback && [_delegate respondsToSelector:@selector(webViewDidFinishLoad:)]) {
[_delegate webViewDidFinishLoad:webView];
}
}
确切地说,调用STATE_WAITING_FOR_LOAD_FINISH情况。 在我的Xcode调试记录器中,我多次收到此消息
2016-01-12 00:07:23.922 MyApp[123:1345] Failed to load webpage with error: The operation couldn’t be completed. (NSURLErrorDomain error -999.)
这会对360VR体验产生恼人的影响。我该如何预防?