将 NSString 转换为 NSURL
这是我的代码,但我收到空结果
NSString *Mystr = [NSString stringWithFormat:@"http://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.xchange where pair in (\"USDEUR\")&env=store://datatables.org/alltableswithkeys"];
NSURL *URLOne = [[NSURL alloc] initWithString:[Mystr stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]];
NSError *error1;
NSString *strresult = [NSString stringWithContentsOfURL:URLOne
encoding:NSASCIIStringEncoding
error:&error1];
NSLog(@"%@", strresult);
这是我的错误
错误域 = NSCocoaErrorDomain 代码 = 256 “无法打开文件“yql”。UserInfo={ NSURL=http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20(%22USDEUR%22)&env =store://datatables.org/alltableswithkeys }