问题
ca someone help me with this
import UIKit
import Firebase
class aboutmeViewController: UIViewController , UITableViewDelegate,UITableViewDataSource {
var refrelation : DatabaseReference!
@IBOutlet weak var me: UITableView!
var relationList = [aboutmeModel] ()
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return relationList.count
}
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
as! ViewControllerTableViewCell
let relation: aboutmeModel
relation = relationList[indexPath.row]
cell.fname.text = relation.firstname
cell.lname.text = relation.lastname
return cell
}
override func viewDidLoad() {
refrelation.observe(DataEventType.value, with: {(snapshot)in
if snapshot.childrenCount>0{
self.relationList.removeAll()
for relations in snapshot.children.allObjects as![DataSnapshot]{
let relationObject = relations.value as? [String: AnyObject]
let firstname = relationObject? ["firstName"]
let lastname = relationObject? ["lastname"]
let pob = relationObject?["dob"]
let age = relationObject?["relation"]
let id = relationObject?["id"]
let relation = aboutmeModel (id: id as!
String?, firstname: firstname
as! String?, lastname: lastname as! String?, relation: age as! String?,
dob: pob as! String?)
self.relationList.append(relation)
}
self.me.reloadData()
}
})
super.viewDidLoad()
// Do any additional setup after loading the view.
}
/*
this is my subclass for the table view
import UIKit
class ViewControllerTableViewCell: UITableViewCell {
@IBOutlet weak var fname: UILabel!
@IBOutlet weak var age: UILabel!
@IBOutlet weak var placeofbirth: UILabel!
@IBOutlet weak var lname: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
what i want my app to do is to fetch the data from the database and display it in the aboutmeviewcontroller, however the app wont even run, i tried following a tutorial on youtube https://www.youtube.com/watch?v=ge56yTgnjKs&t=263s thats the link, however I keep on getting an error, can someone please help!
this is the error im getting.
"Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want."
来源:https://stackoverflow.com/questions/59858375/unable-to-simultaneously-satisfy-constraints-error-whats-causing-this