Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/111.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 基于可达性的语义问题_Ios_Semantics_Reachability - Fatal编程技术网

Ios 基于可达性的语义问题

Ios 基于可达性的语义问题,ios,semantics,reachability,Ios,Semantics,Reachability,一周来,我一直被这个语义问题的警告难住了,它变得越来越令人沮丧。 有人愿意看一下吗?任何建议都将被仁慈地采纳 看 -(网络状态)currentReachabilityStatus不是类方法。使用[[Reachability reachabilityForInternetConnection]currentReachabilityStatus]而不是[Reachability currentReachabilityStatus] currentReachabilityStatus是一个实例方法,因

一周来,我一直被这个语义问题的警告难住了,它变得越来越令人沮丧。 有人愿意看一下吗?任何建议都将被仁慈地采纳 看


-(网络状态)currentReachabilityStatus
不是类方法。

使用
[[Reachability reachabilityForInternetConnection]currentReachabilityStatus]
而不是
[Reachability currentReachabilityStatus]


currentReachabilityStatus
是一个实例方法,因此您首先需要一个实例。

同样的错误仍然存在,只是它没有告诉我:“类方法'+currentReachabilityStatus'未找到”,而是告诉我。。。“找不到InternetConnection的类方法“+reachabilityForInternetConnection”@Sambo发布您的
Reachability.h
请。您从何处获得可访问性实现?@implementation Reachability位于Reachability.m文件中。我知道currentReachabilityStatus是一个NSObject,但我需要做什么来纠正此问题?
#import "WebViewController.h"
#import "Reachability.h"

@implementation WebViewController
@synthesize webView;
@synthesize backbtn;
@synthesize forwardbtn;
@synthesize webAddy;
@synthesize activityIndicator;
@synthesize loadingLabel;


- (void)viewDidLoad {
    loadingLabel.hidden = YES;
    backbtn.enabled = NO;
    forwardbtn.enabled = NO;
    webView.scalesPageToFit = YES;
    activityIndicator.hidesWhenStopped = YES;

    if([Reachability currentReachabilityStatus] == NotReachable)
{ 
        UIAlertView *av = [[[UIAlertView alloc] 
                            initWithTitle:@"Sorry" 
                            message:@"You are not connected to the internet. Please Try again"
                            delegate:nil 
                            cancelButtonTitle:@"OK"
                            otherButtonTitles:nil] autorelease];
        [av setDelegate:self];
        [av show];
    }
    else
    {
        NSURL *url = [NSURL URLWithString:webAddy];
        NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
        [webView loadRequest:requestObj];
    }

    [super viewDidLoad];
}