SWIFT:为什么我无法在UIWebView中加载当前的URL? [英] SWIFT: Why I can't get the current URL loaded in UIWebView?
本文介绍了SWIFT:为什么我无法在UIWebView中加载当前的URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要将当前的URL加载到webview中,这就是我试图得到它的方法,但它给了我这个错误:无法将exporessions类型转换为'ST7 ??'来键入'String'
I need to get the current URL loaded into the webview and this is how I'm trying to get that but it gives me this error: "Cannot convert the exporessions type 'ST7??' to type 'String'
这是代码
var currentURL : NSString = webView.request?.URL.absoluteString!
这有什么问题?
推荐答案
如果你把括号括起来,那么错误就会消失:
If you put parentheses around this, the error goes away:
let currentURL : NSString = (webView.request?.URL.absoluteString)!
这篇关于SWIFT:为什么我无法在UIWebView中加载当前的URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文