//先看代码
NSString *path = @"http://www.baidu.com";
NSURL *url = [NSURL URLWithString:path];
NSLog(@"%@", url);
NSURL *fileUrl = [NSURL fileURLWithPath:path];
NSLog(@"%@", fileUrl);
//输出结果
http://www.baidu.com
http:/www.baidu.com -- file:///
可以看出URLWithString 和 fileURLWithPath 输出结果有明显区别;
如果url是网络地址,用URLWithString;如果URL是本地文件地址,用fileURLWithPath