Wie finden Sie, ob das iPhone Gerät 3G / Wifi verbunden Erreichbarkeits mit
-
12-10-2019 - |
Frage
Kann mir Idee zu finden, ob das iPhone Gerät 3G / Wifi verbunden mit Reachability.kindly Sie mich einige Beispiele / URL .im neu in dieser iphone Entwicklung.
Vielen Dank im Voraus
Lösung
Sie könnten versuchen, aus dem Rechability Beispiel von Apple zu starten http://developer.apple.com/iphone/library/samplecode/Reachability/
Andere Tipps
firstly add SystemConfiguration.framework to your project
//Class.h
#import "Reachability.h"
#import <SystemConfiguration/SystemConfiguration.h>
- (BOOL)connected;
//Class.m
- (BOOL)connected
{
Reachability *reachability = [Reachability reachabilityForInternetConnection];
NetworkStatus networkStatus = [reachability currentReachabilityStatus];
return networkStatus != NotReachable;
}
Then, I use this whenever I want to see if I have a connection:
if (![self connected]) {
// Not connected
} else {
// Connected. Do some Internet stuff
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow