0

我使用 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 体验产生恼人的影响。我该如何预防?

4

0 回答 0