我有一个名为 status 的 NSString
,我正在尝试传递该变量以加载 webView
。该应用程序在这里崩溃,但我不知道我做错了什么?有人看到请求有什么问题吗?
[webView loadRequest:[NSURLRequest requestWithURL:[NSString
stringWithFormat:@"http://www.website.com/page.php?status=%@", status]]];
最佳答案
requestWithURL
接受NSURL
,所以需要将字符串转成NSURL
试试这个,
[webview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://www.website.com/page.php?status=%@", status]]]];
关于iphone - 将 NSString 传递给 Webview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15127327/