iOS:将URL分配给变量,然后在表视图中打开URL

iOS:将URL分配给变量,然后在表视图中打开URL,ios,xcode,ipad,parsing,Ios,Xcode,Ipad,Parsing,iOS的新功能 当我硬编码一个参数,将它作为一个字符串传递给URLWithString时,事情就开始了:就像这样- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [super tableView:tableView didSelectRowAtIndexPath:indexPath]; UIApplication *ourApplication = [UI

iOS的新功能

当我硬编码一个参数,将它作为一个字符串传递给URLWithString时,事情就开始了:就像这样-

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[super tableView:tableView didSelectRowAtIndexPath:indexPath];
UIApplication *ourApplication = [UIApplication sharedApplication];
NSURL *url = [NSURL URLWithString:@"http://files.parse.com/81b196c3-d103-4db1-bb6f-0c74acedfa8c/5f0718e2-a79a-454c-ae9c-082ba28a74-Kontractor_test2.pdf"];
[ourApplication openURL:url];
}
但是当我尝试添加一个object:method,然后将一个变量传递给URLWithString:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object
{
[super tableView:tableView didSelectRowAtIndexPath:indexPath];
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell.textLabel.text = [object objectForKey:@"link"];
NSString *fileURL;
fileURL = cell.textLabel.text;
UIApplication *ourApplication = [UIApplication sharedApplication];
NSURL *url = [NSURL URLWithString:fileURL];
[ourApplication openURL:url];
}

当我单击表格单元格时,模拟器不会打开浏览器。知道为什么会这样吗?谢谢

模拟器不支持您传递的url(电话:、本地资源等)。

如果您添加
NSLog(@“fileURL:%@”,fileURL)它是否以与硬编码相同的方式打印字符串?当您在方法开头放置断点并遍历它时,您看到了什么?