私はIPアドレスに接続できるかどうかを試しています。ReachabilityWithAddressエラーがIPアドレスを与える
私のコードの気圧:
#import "ViewController.h"
#import "SystemConfiguration/SystemConfiguration.h"
@implementation ViewController
struct sockaddr_in ;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
Reachability *d = [Reachability reachabilityWithAddress:const struct sockaddr_in ???????];
NetworkStatus internetStatus = [d currentReachabilityStatus];
//NetworkStatus internetStatus = [d currentReachabilityStatus];
if ((internetStatus != ReachableViaWiFi) && (internetStatus!= ReachableViaWWAN)){
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"No internet" message:@"No internet" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}
else {
UIAlertView *notify = [[UIAlertView alloc] initWithTitle:@"Internet" message:@"There is internet!(not)" delegate:self cancelButtonTitle:@"funny" otherButtonTitles:nil];
[notify show];
[notify release];
}
}
誰かがこの作品を作る方法をplzは私に言うことはできますか?
私は、私はアップルが提供する到達可能性のサンプルでは、このサンプルをテストする方法がIPアドレスを挿入するには...
あなたは、Appleが提供例を読んでみませんなぜ? –
私はそれを読んだことがあります。 +(到達可能性*)reachabilityWithAddress:(const struct sockaddr_in *)hostAddress; 私はホストアドレスを記入する必要がありますが、私の質問は今どのように、あなたは何をお勧めしますか? – Melkon
私が言ったように - Appleが提供する例を確認してください。それは理由があります - それはあなたにこれを行う方法の完全な例を示しています。 [リンク](https://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html) –