¿Cómo verifico la accesibilidad de un server ?

Posible duplicado:
Símbolos no definidos para la architecture armv7: "_SCNetworkReachabilityCreateWithAddress"

Probé un par de cosas que encontré aquí y ninguna funcionó. Agregué los files reachability.h y .m de Apple a mi proyecto. Estoy intentando probar la accesibilidad de un server magnate, y el siguiente es el código que utilicé dentro de mi progtwig real:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleNetworkChange:) name:kReachabilityChangedNotification object:nil]; reach = [Reachability reachabilityForInternetConnection]; [reach startNotifier]; NetworkStatus remoteHostStatus = [reach currentReachabilityStatus]; if (remoteHostStatus == NotReachable) { NSLog(@"no"); textTest.text = @"Can't reach it"; } else if(remoteHostStatus == ReachableViaWiFi || remoteHostStatus == ReachableViaWWAN){ NSLog(@"Yes"); textTest.text = @"Got it"; } testServer.hidden = YES; .... -(void)handleNetworkChange:(NSNotification *)notice{ NetworkStatus remoteHostStatus = [reach currentReachabilityStatus]; if (remoteHostStatus == NotReachable) { NSLog(@"no"); textTest.text = @"Can't get it"; } else if(remoteHostStatus == ReachableViaWiFi || remoteHostStatus == ReachableViaWWAN){ NSLog(@"Got it"); textTest.text = @"Got it"; } } 

y en el file .h:

 @property (retain, nonatomic) Reachability *reach; .... -(void)handleNetworkChange:(NSNotification *)notice; 

Cada vez que trato de comstackr y ejecutar esto es lo que obtengo:

 Ld /Users/ConorMccallion/Library/Developer/Xcode/DerivedData/newClient-aunayptutxnlhjeoflldefcmybpk/Build/Products/Debug-iphonesimulator/newClient.app/newClient normal i386 cd /Volumes/TRAVELDRIVE/Reseaech/ClientSide/newClient setenv IPHONEOS_DEPLOYMENT_TARGET 6.0 setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk -L/Users/ConorMccallion/Library/Developer/Xcode/DerivedData/newClient-aunayptutxnlhjeoflldefcmybpk/Build/Products/Debug-iphonesimulator -F/Users/ConorMccallion/Library/Developer/Xcode/DerivedData/newClient-aunayptutxnlhjeoflldefcmybpk/Build/Products/Debug-iphonesimulator -filelist /Users/ConorMccallion/Library/Developer/Xcode/DerivedData/newClient-aunayptutxnlhjeoflldefcmybpk/Build/Intermediates/newClient.build/Debug-iphonesimulator/newClient.build/Objects-normal/i386/newClient.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=6.0 -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/ConorMccallion/Library/Developer/Xcode/DerivedData/newClient-aunayptutxnlhjeoflldefcmybpk/Build/Products/Debug-iphonesimulator/newClient.app/newClient Undefined symbols for architecture i386: "_SCNetworkReachabilityCreateWithAddress", referenced from: +[Reachability reachabilityWithAddress:] in ViewController.o +[Reachability reachabilityWithAddress:] in Reachability.o "_SCNetworkReachabilityCreateWithName", referenced from: +[Reachability reachabilityWithHostName:] in ViewController.o +[Reachability reachabilityWithHostName:] in Reachability.o "_SCNetworkReachabilityGetFlags", referenced from: -[Reachability connectionRequinetworking] in ViewController.o -[Reachability currentReachabilityStatus] in ViewController.o -[Reachability connectionRequinetworking] in Reachability.o -[Reachability currentReachabilityStatus] in Reachability.o "_SCNetworkReachabilityScheduleWithRunLoop", referenced from: -[Reachability startNotifier] in ViewController.o -[Reachability startNotifier] in Reachability.o "_SCNetworkReachabilitySetCallback", referenced from: -[Reachability startNotifier] in ViewController.o -[Reachability startNotifier] in Reachability.o "_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from: -[Reachability stopNotifier] in ViewController.o -[Reachability stopNotifier] in Reachability.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) 

Probablemente sea algo obvio, por lo que una respuesta sería muy apreciada. Gracias

Si desea verificar la accesibilidad de un host en particular, puede usar el siguiente código,

 Reachability *reach = [Reachability reachabilityWithHostName:@"www.apple.com"]; 

Aquí puede pasar su nombre de server como el nombre de host para verificar la accesibilidad. Deberia de funcionar. Consulte la documentation de Apple para más detalles.

Para el post de error que está recibiendo, intente agregar SystemConfiguration.framework al proyecto. Si eso no ayuda, compruebe estos símbolos no definidos para la architecture armv7: "_SCNetworkReachabilityCreateWithAddress" .

en el método didFinishLaunchingWithOptions puesto:

self.internetReach= [Reachability reachabilityWithHostName:@"your host name egwww.apple.com"];

 [internetReach startNotifier]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reachabilityChanged:) name:kReachabilityChangedNotification object:nil]; [self performSelector:@selector(reachabilityChanged:) withObject:[NSNotification notificationWithName:kReachabilityChangedNotification object:internetReach]]; 

esto llamará a continuación método

 - (void)reachabilityChanged:(NSNotification*)note 

{

 Reachability* curReach = [note object]; NSParameterAssert([curReach isKindOfClass: [Reachability class]]); if(curReach == self.internetReach) { NetworkStatus netStatus = [curReach currentReachabilityStatus]; switch (netStatus) { case ReachableViaWiFi: { isInternetConnectionAvilable=YES; if(isNetworkNotifierCalledOnce) { UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Message!" message:@"Internet Available Now" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; } break; } case NotReachable: { isInternetConnectionAvilable=NO; UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Message!" message:@"No Internet Connectivity" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; break; } } } isNetworkNotifierCalledOnce=YES; 

}