- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSLog(@"-------------------------");
[NSThread detachNewThreadSelector:@selector(resData) toTarget:self withObject:nil];
NSString* url = @"http://app.bell365.com/cast365/api/intro.asp?mcd=GOOGLE&appver=10000";
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
request.timeoutInterval = 10;
NSError* error = nil;
NSURLResponse* response = nil;
NSData* data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSLog(@"data = %@", data);
NSString* dataStr = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"dataStr = %@", dataStr);
NSLog(@"-------------------------");
}
-(void)resData
{
NSLog(@"**********************");
NSURLRequest* request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://naver.com"]];
NSData* data = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
NSLog(@"data = %@", data);
NSString* dataStr = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"dataStr = %@", dataStr);
NSLog(@"**********************");
}