尝试发送数据以查看时发生映射问题

时间:2019-01-03 15:36:06

标签: swift

  

线程1:致命错误:在展开可选值时意外发现nil

使用Firebase数据库保存联系信息并进行处理 这是它的模型

型号

ggplot(data =  filter(sleepstudy, id == 1), aes(x=Days, y=Reaction)) +
  geom_point() +
  geom_point(aes(y=predicted), col = "red") +
  geom_line(aes(y=median), col ="black" ) +
  geom_line(aes(y=lower), col ="black", lty = 2) +
  geom_line(aes(y=upper), col ="black", lty = 2) +
  geom_line(aes(y=fit), col = "red") +
  geom_line(aes(y=lwr), col = "red", lty = 2) +
  geom_line(aes(y=upr), col = "red", lty = 2)

尝试更改标签出口名称时出错

struct Contact {
var email: String!
var username: String!
var profileimage: String?
var userid: String!

init(email: String , username: String, profileimage: String, userid: String) {
    self.email = email
    self.username = username
    self.profileimage = profileimage
    self.userid = userid
}
}

在第二个视图中取消了联系人

    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    let user = self.users[indexPath.row]
    let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
    let newViewController = storyBoard.instantiateViewController(withIdentifier: "ChatMessagesController") as! ChatMessagesController
    newViewController.user = user
    newViewController.navBarLabel.text = user.username

    self.present(newViewController, animated: true, completion: nil)
    }
}

1 个答案:

答案 0 :(得分:1)

在vc加载之前,出口一直为零

newViewController.loadViewIfNeeded() 
newViewController.navBarLabel.text = user.username

var username: String!也可能是原因,因此请确保不是nil