如何通过iphone或objective-c检查互联网连接?
发布于 2009-11-26 18:56:56
以下是您可以使用的代码片段:
[[Reachability sharedReachability] setHostName:@"example.com"];
if ([[Reachability sharedReachability] remoteHostStatus] == NotReachable) {
UIAlertView *dialog = [[[UIAlertView alloc] init] retain];
[dialog setTitle:@"Server unreachable"];
[dialog setMessage:@"The server is temporarily unavailable."];
[dialog addButtonWithTitle:@"OK"];
[dialog show];
[dialog release];
}发布于 2009-11-26 17:43:50
Quick and Drity: Ping Google?
发布于 2009-11-26 17:48:08
苹果的建议是做一些类似(或使用) Reachability的事情
https://stackoverflow.com/questions/1802592
复制相似问题