【发布时间】:2015-08-29 11:10:57
【问题描述】:
我创建了一个 UIWebView,我在 url 中附加了一个参数:
let url = NSURL(string: "http://localhost:8888/?apptype=native")
let request = NSURLRequest(URL: url!)
WebView.loadRequest(request)
当我在 UIWebView 中加载第一页时,参数存在,我可以使用 php 获取它。
但是当我切换到另一个页面时,参数消失了,我无法在服务器端使用 php 从 url 中获取它。
所以我找到了这个委托方法:
func webView(WebViewNews: UIWebView, shouldStartLoadWithRequest request: NSURLRequest, navigationType: UIWebViewNavigationType) -> Bool {
return true
}
但是如何每次在 UIWebView 中加载新页面时附加参数??
问候和感谢!
【问题讨论】:
-
是否可以附加参数?
标签: swift url parameters uiwebview nsurlrequest