无法识别ReachabilityManager单例类方法

时间:2015-08-25 17:01:05

标签: ios objective-c singleton reachability

我试图实现我的ReachabilityManager单例并检查互联网是否可以访问。不幸的是,当我尝试调用类方法时,我得到了这个错误。

enter image description here

要查看清单:

1)我已将可访问性和我的经理导入到我正在使用的tableView中。 enter image description here

2)我在我的单身人士中实现了类方法。 enter image description here

3)我还在appDelegate中实例化了经理。 enter image description here

那么我错过了什么?

2 个答案:

答案 0 :(得分:1)

isReachable是一个类方法,你试图通过这样做从这个类的对象中调用一个类方法

[[InternetReachabilityManager sharedManager] isReachable] ; 

为了使它能够工作,你应该从类本身调用你的类方法,而不是像这样从类中创建一个对象:

[InternetReachabilityManager isReachable] ;

答案 1 :(得分:0)

根据您发布的内容,您不需要为共享实例发送消息,因为isReachable是您的类方法。只是:

[InternetReachabilityManager isReachable] 

应该有用。