gpt4 book ai didi

swift - 类型 'MessagesController?' 没有成员 'setupNavBarWithUser'

转载 作者:行者123 更新时间:2023-11-30 11:54:20 24 4
gpt4 key购买 nike

嘿,大家好,我已经在 View Controller 文件中创建了自定义 View Controller ,并且我正在尝试从另一个 View Controller 调用其函数。

fileprivate func registeruserintoDb(_ uid: String, values: [String: AnyObject]) {
let ref = Database.database().reference()
let usersReference = ref.child("users").child(uid)

usersReference.updateChildValues(values, withCompletionBlock: { (err, ref) in

if err != nil {
print(err!)
return

}

// self.messagesController?.fetchUserAndSetupNavBarTitle()
// self.messagesController?.navigationItem.title = values["name"] as? String
let user = User(dictionary: values)

MessagesController?.setupNavBarWithUser(user)

self.dismiss(animated: true, completion: nil)
})
}

}

最佳答案

正如错误所述,MessagesController 是一个类(类型),而不是一个对象。您需要先初始化一个对象:

let customViewController = MessagesController()
customViewController.setupNavBarWithUser(user)

关于swift - 类型 'MessagesController?' 没有成员 'setupNavBarWithUser',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47990718/

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