【发布时间】:2015-07-07 07:36:53
【问题描述】:
我正在使用键盘,我刚刚安装了 xcode 7 beta 2 然后我收到很多警告。
超过 24 个黄色错误我认为它会导致键盘崩溃 关于 xcode 6.4 无错误无键盘课程
我发现解决这些错误有困难。
警告:
从 UITextDocumentProxy 到 UIKeyInput 的条件转换总是成功
func handleBtnPress(sender: UIButton) {
if let kbd = self.keyboard {
if let textDocumentProxy = kbd.textDocumentProxy as? UIKeyInput {
textDocumentProxy.insertText(sender.titleLabel!.text!)
}
kbd.hideLongPress()
if kbd.shiftState == ShiftState.Enabled {
kbd.shiftState = ShiftState.Disabled
}
kbd.setCapsIfNeeded()
}
}
警告:
从 UITouch 到 UITouch 的条件转换总是成功
override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
for obj in touches {
if let touch = obj as? UITouch {
let view = self.touchToView[touch]
let touchPosition = touch.locationInView(self)
if self.bounds.contains(touchPosition) {
self.handleControl(view, controlEvent: .TouchUpInside)
}
else {
self.handleControl(view, controlEvent: .TouchCancel)
}
self.touchToView[touch] = nil
}
}
}
【问题讨论】:
-
只是一点点信息:“黄色错误”实际上是警告 :) (y) 请告诉我们警告发生在哪一行。
标签: ios xcode swift xcode7 ios9