我创建了一个简单的网络视图应用程序。但有一个小问题我无法修复。它加载第一页没有问题。
当我单击第一个输入时,程序崩溃,错误代码如下:
2017-10-28 23:50:54.289690+0400 BFI Schools[68425:3885613] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
我的代码如下:
//
// ViewController.swift
// BFI Schools
//
// Created by Kamandar Abdullayev on 10/28/17.
// Copyright © 2017 ROOM404.AZ. All rights reserved.
//
import UIKit
import WebKit
class ViewController: UIViewController , UIWebViewDelegate {
@IBOutlet weak var webView: UIWebView!
@IBOutlet weak var spinner: UIActivityIndicatorView!
override func viewDidLoad() {
super.viewDidLoad()
view.translatesAutoresizingMaskIntoConstraints=false
let url = URL(string: "https://www.parent.e-hism.co")!
let request = URLRequest(url: url)
if Reachability.isConnectedToNetwork() == true {
webView.loadRequest(request)
} else {
let alert = UIAlertView(title: "No Internet Connection", message: "Make sure your device is connected to the internet.", delegate: nil, cancelButtonTitle: "OK")
alert.show()
}
}
func webViewDidStartLoad(_ : UIWebView) {
spinner.startAnimating()
}
func webViewDidFinishLoad(_ : UIWebView) {
spinner.stopAnimating()
}
}
我尝试了在互联网上找到的所有帮助,但没有成功。
根据 Reveal 的以下捕获,这似乎是 Apple 代码中的自动布局问题。我打赌他们会在某个时候修复它。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)