gpt4 book ai didi

swift - NotificationCenter 将 swift 3 迁移到 swift 4.2 的问题

转载 作者:搜寻专家 更新时间:2023-10-30 22:24:50 24 4
gpt4 key购买 nike

<分区>

我在尝试将我的代码从 Swift 3 迁移到 Swift 4.2 时遇到问题

这里是当前要迁移的代码:

fileprivate func observeKeyboardNotifications() {

NotificationCenter.default.addObserver(self, selector: #selector(keyboardShow), name: .UIKeyboardWillShow, object: nil)

NotificationCenter.default.addObserver(self, selector: #selector(keyboardHide), name: .UIKeyboardWillHide, object: nil)
}

这是我设法做到的:

fileprivate func observeKeyboardNotifications() {

NotificationCenter.default.addObserver(self, selector: #selector(keyboardShow), name: NSNotification.Name.UIResponder.UIKeyboardWillShowNotification, object: nil)

}

我仍然得到错误:

Type of expression is ambiguous without more context

我整天都在编码,所以我什至看不出这段代码有什么问题。谁能帮我解决这个问题?

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