【发布时间】:2010-09-04 10:23:56
【问题描述】:
NSURLConnection 和 NSURL 有什么区别?
我的意思是,如果我正在下载一个文件,它会影响我使用哪个文件吗?
Rgds
为:
NSString *myUrl = @"http://www.test.com/";
NSString *returnData = [NSString stringWithContentsOfURL:[NSURL URLWithString: myUrl]];
或
NSString *myUrl = @"http://www.test.com/";
NSURLRequest *myRequest = [[NSURLRequest alloc] initWithURL: [NSURL URLWithString:myUrl] ];
NSString *returnData = [NSURLConnection sendSynchronousRequest:myRequest returningResponse: nil error: nil ];
有什么区别?
谢谢
【问题讨论】:
标签: iphone nsurlconnection nsurl