Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xcode 动态UIWebView链接_Xcode_Ios6 - Fatal编程技术网

Xcode 动态UIWebView链接

Xcode 动态UIWebView链接,xcode,ios6,Xcode,Ios6,所以通常我会加载UIWebView NSURL *url = [NSURL URLWithString:@"http://www.google.com"]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [_webView loadRequest:request]; 但是,现在我需要根据用户单击的表单元格动态地执行此操作。我从JSON加载表格单元格,一切正常。现在我需要在单元格中获取帖子的“id”,并动态

所以通常我会加载UIWebView

   NSURL *url = [NSURL URLWithString:@"http://www.google.com"];
   NSURLRequest *request = [NSURLRequest requestWithURL:url];
   [_webView loadRequest:request];
但是,现在我需要根据用户单击的表单元格动态地执行此操作。我从JSON加载表格单元格,一切正常。现在我需要在单元格中获取帖子的“id”,并动态加载它。目前我已经试过了,但不起作用

NSURL *url = [NSURL URLWithString:@"http://www.google.com/story.php?id="];
url = [NSURL URLWithString:storyId relativeToURL:url];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[_webView loadRequest:request];

有什么提示吗?

为什么不格式化URL字符串

NSURL *url = [NSURL URLWithString:[NSString 
            stringWithFormat:@"http://www.google.com/story.php?id=%@", storyId]];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[_webView loadRequest:request];

当我这样做时,UIWebView不会加载任何网页。我甚至没有收到404错误。只是一个白页如果你将相同的URL粘贴到Safari中会发生什么?它装东西了吗?在代码中测试URL之前,请验证URL是否在标准浏览器中工作。