是什么导致NSNull长度无法识别的选择器keyCommand错误 [英] What is causing NSNull length unrecognized selector keyCommand error

查看:110
本文介绍了是什么导致NSNull长度无法识别的选择器keyCommand错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个项目中有这个课程/故事板场景,直到昨晚我工作的过去4个星期工作正常。

I have this class/storyboard scene in a project that up to last night worked fine for the past 4 weeks i worked on it.

我已成功评论实际上几乎所有东西,当我点击UITextField并键入数字时,我仍然会遇到崩溃。当我输入一个值时它只会崩溃,否则它不会崩溃。

I have managed to comment out practically everything and I still get the crash when tapping on the UITextField and typing a number. It only crashes when I type in a value, otherwise it doesn't crash.

这是我正在运行它的类:

Here is the class as I am running it now:

import Foundation
import UIKit
import HealthKit
import CoreData

class WorkoutViewController: UITableViewController {

//Properties
    @IBOutlet var numberOfLapsTextField: UITextField?
    @IBOutlet var metersPerLapTextField: UITextField?
    @IBOutlet var workoutDurationTextField: UITextField?
    @IBOutlet var paceTextField: UITextField?

    var  healthStore:HKHealthStore?

override func viewDidLoad() {
        super.viewDidLoad()
}

最初它有IBOutlets!代替 ?它具有CoreData堆栈属性,对于tableview背景有一些模糊的背景效果,在viewDidLoad上从健康商店获取用户的权重,用于健康商店提取的谓词帮助方法以及取消和完成按钮。完成按钮从文本字段中捕获数据,进行一些计算并将数据保存到健康商店和coredata。但是所有这些都被注释掉了,只剩下上面看到的内容。

Originally it had the IBOutlets as ! instead of ? And it has a CoreData stack property, some blurred background effects for the tableview background, fetches user's weight from health store on viewDidLoad, a predicate helper method for health store fetches and a cancel and done button. The done button captured data from the textfields, made some computations and saved data to the health store and to coredata. But ALL of this has been commented out leaving only what is seen above.

我确实设法在控制台中得到一个奇怪的堆栈跟踪一次(似乎不能得到它了:

I did managed to get a weird stack trace in the console one time (can't seem to get it anymore) that read:

[UIPhysicalKeyboardEvent _matchesKeyCommand:]

[UIPhysicalKeyboardEvent _matchesKeyCommand:]

以及之前的其他几个喜欢它它。

and a few others like it just before it.

我很难过,有什么想法吗?异常断点是一个但它只是将我抛给AppDelegate类声明行,其中采用了UIResponder。我学习并重建了。我不知道还能找什么。

Im stumped, any ideas? Exception breakpoints is one but it just throws me to the AppDelegate class declaration line where UIResponder is adopted. Ive learned and rebuilt. I don't know what else to look for.

我认为它是一个腐败的故事板文件,因为我添加和删除了带有文本字段的场景,它们都表现相同。这是我的storyboard.xml文件:

Im thinking its a corrupt storyboard file because Ive added and removed scenes with textfields and they all behave the same. Here is my storyboard.xml file:

http://www.santiapps.com/iOS/Main.storyboard.xml

推荐答案

好的我删除了导航控制器和标签栏控制器并重新添加它们,问题就消失了!输入数据时不再有崩溃。这显然是一个腐败的场景,但奇怪的是,突然之间,uitextfields的所有场景都以同样的方式被破坏了。

Ok I deleted the navigation controllers and tab bar controller and re-added them, and the problem is gone! There are no more crashes when I type in data. It was obviously a corrupted scene but the weird thing is that all of a sudden, all scenes with uitextfields got corrupted in the same way.

我想补充一下高级SO用户应该花时间与用户在投票前发布问题进行交谈。或者然后允许用户对问题进行投票,因为某些人跳出结论并开始投票到一个实际上是有效问题的问题是非常不公平的。

I'd like to add that advanced SO users should really take the time to talk to users posting issues before they down vote. Or users should then be allowed to up-vote the question back because it's really unfair that some people jump to conclusions and start down voting to a question that is actually a valid issue.

这篇关于是什么导致NSNull长度无法识别的选择器keyCommand错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆