NSURLErrorDomain错误-999-iOS中的链接失败 [英] NSURLErrorDomain error -999 - links failing in iOS

查看:195
本文介绍了NSURLErrorDomain错误-999-iOS中的链接失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行内部HTML页面的iOS应用,这些页面全部来自HTML主菜单

I have an iOS app running a bunch of internal HTML pages all coming out from a HTML main menu

我正在使用Hype来构建页面.

I'm using Hype to construct the pages.

菜单不可靠,有时可以识别鼠标单击,有时不能识别

The menu is not reliable, sometimes mouse clicks are recognised, sometimes not

成功并加载页面后-子页面加载时,我的xcode输出控制台会向我显示以下消息

When successful and the page loads - My xcode output console is giving me the following message when the sub page loads

无法加载网页,并显示以下错误:无法执行该操作 完全的. (NSURLErrorDomain错误-999.)

Failed to load webpage with error: The operation couldn’t be completed. (NSURLErrorDomain error -999.)

每个页面具有2个iFrame(一个用于附加内容,一个用于音频播放器)

The pages in question each feature 2 iFrames ( one for additional content, 1 for an audio player)

取出iFrame可以治愈它,但它们是该应用程序的核心

Taking out the iFrames cures it but they are kinda core to the App

我一直在检查,发现有些人建议插入此

I've been checking around and have seen that some folk suggest inserting this

if ([error code] != NSURLErrorCancelled) {
//show error alert, etc.
}

进入我的项目,但作为使用xcode的菜鸟,我不确定将其放置在何处

into my project but as a noob with xcode, I'm unsure of where to place it

非常感谢-感谢

推荐答案

通常在MainViewController.m中

Normally in MainViewController.m

- (void) webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error 
{
    NSLog(@"Error %i", error.code);
    if (error.code == NSURLErrorCancelled) { 
        return; // this is Error -999
    }
    return [super webView:theWebView didFailLoadWithError:error];
}

这篇关于NSURLErrorDomain错误-999-iOS中的链接失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆