ios检测网络图片是否存在 iosuiwebviewurl网络图片是否存在 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 先用NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; 判断一下当前的链接。-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response{ NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; if ((([httpResponse statusCode]/100) == 2)) { // self.earthquakeData = [NSMutableData data]; [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; [ webView loadRequest:[ NSURLRequest requestWithURL: myUrl ]]; webView.delegate = self; } else { NSDictionary *userInfo = [NSDictionary dictionaryWithObject: NSLocalizedString(@"HTTP Error", @"Error message displayed when receving a connection error.") forKey:NSLocalizedDescriptionKey]; NSError *error = [NSError errorWithDomain:@"HTTP" code:[httpResponse statusCode] userInfo:userInfo]; if ([error code] == 404) { NSLog(@"网络图片不存在"); webView.hidden = YES; //隐藏webView或者用本地默认图片代替 } }} 不知道楼主具体是怎么实现的,我是利用js实现的,在img标签中加上onerro,不只是不存在,要是访问出错也会座对应的操作 万分感谢楼上两位,因为访问的图片比较多,所以没有使用第一种方法,使用了楼二的onerror方法,虽然没有根本上解决我的问题,但是已经很有帮助了,谢谢谢谢, 想做个答题的应用 希望高手给个思路~ 关于iphone后台下载的问题 后台定时截屏 NSProgress进度条重画问题 mac地址,十万火急 大神们,IOS 能不能捕获全局异常 iOS中使用live555发送sendTeardownCommand命令关闭一个RTSP时会报错 求助,苹果上架问题,有没有大神来指导下啊!拜谢!!! ios开发----谁有没有做过用户登录过期,重新登录,跳到退出前的那个界面 高手看过来!求解,坐等回复啊!看了好几天,没有头绪。 请教各位一个问题:facetime或者 企鹅 视频 中 远端的视频是如何展现的? 如何在tableView的第一列添加输入框?
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; 判断一下当前的链接。
-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response{
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
if ((([httpResponse statusCode]/100) == 2)) {
// self.earthquakeData = [NSMutableData data];
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
[ webView loadRequest:[ NSURLRequest requestWithURL: myUrl ]];
webView.delegate = self;
} else {
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:
NSLocalizedString(@"HTTP Error",
@"Error message displayed when receving a connection error.")
forKey:NSLocalizedDescriptionKey];
NSError *error = [NSError errorWithDomain:@"HTTP" code:[httpResponse statusCode] userInfo:userInfo];
if ([error code] == 404) {
NSLog(@"网络图片不存在");
webView.hidden = YES; //隐藏webView或者用本地默认图片代替
}
}
}