내 앱에 사용자가 인터넷에 연결되어 있지 않을 때 경고 메시지를 표시하고 싶습니다. 아래 코드를 사용했지만 절대로이 블록에 들어 가지 않습니다. 결코 호출되지 않습니다.iOS - 인터넷에 연결되어 있지 않을 때 연결 실패 경고 메시지
사용자가 인터넷에 연결되어 있는지 여부를 어떻게 제어 할 수 있습니까?
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
NSLog(@"connect");
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Connection Failed" message:@"check your internet connection" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
}
참고 : 나는 아이폰 OS 5.1 버전을 사용하고 난 인터넷 연결의 가용성을 확인 Reachability 등급을 시도해보십시오 .H 파일
내가 대표가이 방법이있는 NSURLConnection – Vatev
의 위임에 있는지 확인 : NSURLConnectionDataDelegate, NSURLConnectionDelegate – ercan
https://developer.apple.com/library/mac/#documentation/Foundation/Reference/NSURLConnectionDelegate_Protocol/Reference/Reference .html 그것은 NSURLConnectionDelegate에 있습니다. – hkulekci