के लिए जाँच करने के लिए गम्यता वर्ग का उपयोग कर दुर्घटनाग्रस्त मैं एक इंटरनेट कनेक्शन के लिए जाँच करने के लिए इस कोड का उपयोग कर रहा हूँ, लेकिन मैं एक दुर्घटना +[Reachability reachabilityForInternetConnection]: unrecognized selector sent to class 0xcbe0c8
अनुप्रयोग जब इंटरनेट कनेक्शन
मैं आयात किया है Reachability .h/.m और systemConfig ढांचे कह हो रही है। क्रैश लाइन self.internetRechable = [[Reachability reachabilityForInternetConnection] retain];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(checkNetworkStatus:) name:kReachabilityChangedNotification object:nil];
self.internetRechable = [[Reachability reachabilityForInternetConnection] retain];
[self.internetRechable startNotifier];
// check if a pathway to a random host exists
self.hostReachable = [[Reachability reachabilityWithHostName: @"www.apple.com"] retain];
[self.hostReachable startNotifier];
- (void) checkNetworkStatus:(NSNotification *)notice
{
// called after network status changes
NetworkStatus internetStatus = [self.internetRechable currentReachabilityStatus];
switch (internetStatus)
{
case NotReachable:
{
NSLog(@"The internet is down.");
// self.internetActive = NO;
break;
}
case ReachableViaWiFi:
{
NSLog(@"The internet is working via WIFI.");
// self.internetActive = YES;
break;
}
case ReachableViaWWAN:
{
NSLog(@"The internet is working via WWAN.");
// self.internetActive = YES;
break;
}
}
NetworkStatus hostStatus = [self.hostReachable currentReachabilityStatus];
switch (hostStatus)
{
case NotReachable:
{
NSLog(@"A gateway to the host server is down.");
// self.hostActive = NO;
break;
}
case ReachableViaWiFi:
{
NSLog(@"A gateway to the host server is working via WIFI.");
// self.hostActive = YES;
break;
}
case ReachableViaWWAN:
{
NSLog(@"A gateway to the host server is working via WWAN.");
// self.hostActive = YES;
break;
}
}
}
नहीं, मैंने '@class Reachability' किया है और मैंने – Jon
आयात किया है हां, आईव ने फाइलों को आयात किया है और मैंने' # आयात "Reachability.h" ' – Jon
किया है, मैंने ऐसा किया 'पहुंच योग्यता * नई पहुंच = [पहुंच योग्यता पहुंचने योग्यता इंटरनेशनल कनेक्शन] पर क्रैशिंग;' – Jon