ios - 在 UIWebView 中显示身份验证提示
<p><p>我想访问一个 Sharepoint 站点,但是当 Office365 尝试将我重定向到我的身份验证组织页面时 UIWebView 被阻止。在桌面上,我看到一个带有 2 个文本字段的提示,但是,这里什么也没有!这是我的代码和屏幕截图:</p>
<pre><code>class ViewController: UIViewController, NSURLConnectionDelegate {
@IBOutlet var webView: UIWebView!
@IBOutlet var refresh: UIBarButtonItem!
override func viewDidLoad() {
super.viewDidLoad()
if let theURL = URL(string: "https://expertime365.sharepoint.com/sites/retail-portal-v8/Pages/default.aspx") {
let request = URLRequest(url: theURL)
webView.loadRequest(request)
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
</code></pre>
<p>}</p>
<p>这是截图:</p>
<p> <img src="/image/lbFlZl.png" alt="screenshot"/> </p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>是否检查了 webView 中加载的 url?</p>
<p>如果没有,请检查以下链接并与桌面浏览器中加载的网址进行比较。</p>
<p>您可以查看以下代码:</p>
<pre><code>func webView(webview: UIWebView, shouldStartLoadWithRequest request: NSURLRequest, navigationType: UIWebViewNavigationType) -> Bool {
let currentURL = request.URL.absoluteString
print("\(currentURL)")
}
</code></pre></p>
<p style="font-size: 20px;">关于ios - 在 UIWebView 中显示身份验证提示,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/39893033/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/39893033/
</a>
</p>
页:
[1]