gpt4 book ai didi

ios - NSURL WebView 未加载

转载 作者:可可西里 更新时间:2023-11-01 02:04:41 26 4
gpt4 key购买 nike

我的 WebView 没有加载只是空白这是我的代码

//
// SecondViewController.swift
// Bachelmatt Garage
//
// Created by Thilo Jaeggi on 24.05.17.
// Copyright © 2017 Thilo Jaeggi. All rights reserved.
//

import UIKit

class SecondViewController: UIViewController {
@IBOutlet var webView: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let url = URL (string: "http://www.sourcefreeze.com");
let request = URLRequest(url: url!);
webView.loadRequest(request);
}


override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}


}

一年前我已经问过同样的问题,听说我需要在 Xcode 中启用“安全设置”,这里的情况是否相同?提前致谢。

最佳答案

请在您的 info.plist(作为源代码打开)文件中添加以下行

<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

有关更多信息,请查看此 Transport security has blocked a cleartext HTTP

谢谢

关于ios - NSURL WebView 未加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44177754/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com