Apple에서 제공하는 Rechablity.h 및 Rechablity.h를 사용하고 있으며이 파일을 사용하고이 오류가 발생합니다. "링커 명령이 종료 코드 1 (호출을 보려면 -v 사용)에 실패했습니다."
과 같은 코드를 추가했습니다.#pragma mark Rechability method
/**
* reachabilityChanged()
* @desc Check the internet connection
* @param NSNotification note is the notification of internet state changed
*/
- (void) reachabilityChanged: (NSNotification*)note {
Reachability* curReach = [note object];
NSParameterAssert([curReach isKindOfClass: [Reachability class]]);
[self updateInterfaceWithReachability: curReach];
}
/**
* updateInterfaceWithReachability()
* @desc Update the internet connection state
* @param Reachability curReach is the instance of Reachbility
*/
- (void) updateInterfaceWithReachability: (Reachability*) curReach {
if(curReach == internetReach) {
NetworkStatus netStatus = [curReach currentReachabilityStatus];
BOOL connectionRequired = [curReach connectionRequired];
NSString* statusString = @"";
switch (netStatus) {
case NotReachable: {
statusString = @"Access Not Available";
connectionRequired = NO;
isInternetAvailable = FALSE;
break;
}
case ReachableViaWWAN: {
statusString = @"Reachable WWAN";
isInternetAvailable = TRUE;
break;
}
case ReachableViaWiFi: {
statusString = @"Reachable WiFi";
isInternetAvailable = TRUE;
break;
}
}
if(connectionRequired)
statusString = [NSString stringWithFormat: @"%@, Connection Required", statusString];
//UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Gmmabling Gambit" message:statusString delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Ok",nil];
// [alert show];
// [alert release];
//NSLog(@"%@",statusString);
}
}
/**
* internetCheck()
* @desc store the internet connection state
* @return BOOL internet is available or not
*/
- (BOOL)internetCheck {
return isInternetAvailable;
}
추가 systemConfiguration.framework 및 Security.framework 있지만 bundle resources
에 .m file
추가하지 않은 경우 오류
clang: error: linker command failed with exit code 1 (use -v to see invocation)
이 파일은 이미 컴파일 리소스에 추가되었습니다 – ASHISHT
프로젝트를 확장하고 프로젝트에서 누락 될 모든 파일 (가져온 라이브러리 또는 헤더/구현 파일)을 확인하십시오 (구체적으로 빨간색으로 강조 표시됨) –
마지막으로 솔루션을 얻었습니다. <3 – ASHISHT