와 연결 :이 코드를 사용하고 NSURLRequest
NSString *recievedData;
NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.site.com/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0];
// create the connection with the request
// and start loading the data
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
if (theConnection) {
// Create the NSMutableData to hold the received data.
// receivedData is an instance variable declared elsewhere.
recievedData = [NSMutableData data];
NSLog(@"%@", recievedData);
} else {
// Inform the user that the connection failed.
NSLog(@"Unsuccessful.");
}
그것은 this의 수정 된 버전입니다.
내 문제는 항상 내가 인터넷에 연결되어있어 여부, 항상 성공으로가는 여부
<>
를 반환한다는 것입니다.