내 프로젝트에서 도달 가능성을 사용하고 있으며 연결 유형에 대한 정보를 얻으려고하면이 오류가 발생합니다.연결 가능성이있는 연결 상태
*** Assertion failure in -[Reachability currentReachabilityStatus],/myProjectPath/Reachability.m:530
2012-04-03 21:25:45.619 Traffic[7862:11603] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'currentNetworkStatus called with NULL reachabilityRef'
내 코드에 어떤 문제가 있는지 알 수 없습니다. ReachabilityAppDelegate에서와 동일한 코드를 연결 상태에 연결합니다.
내 코드 : 응용 프로그램의 위임에
//Called by Reachability whenever status changes.
- (void) reachabilityChanged: (NSNotification*)note
{
Reachability* curReach = [note object];
NSParameterAssert([curReach isKindOfClass: [Reachability class]]);
[self updateInterfaceWithReachability: curReach];
}
: 대한
// get type of user connection
NSString* statusString= @"NA";
Reachability *curReach = [[Reachability alloc] init];
NetworkStatus netStatus = [curReach currentReachabilityStatus];
BOOL connectionRequired= [curReach connectionRequired];
switch (netStatus)
{
case NotReachable:
{
statusString = @"NA";
//Minor interface detail- connectionRequired may return yes, even when the host is unreachable. We cover that up here...
connectionRequired= NO;
break;
}
case ReachableViaWWAN:
{
statusString = @"WWAN";
break;
}
case ReachableViaWiFi:
{
statusString= @"WIFI";
break;
}
}