我本周开始使用 swift 编程,并尝试在我的应用程序中制作一个简单的导航栏。这不是我第一次遇到这个错误,并且不知道可能缺少什么。如果我没记错的话,我正确地连接了从用户界面到代码的所有内容,但输出显示:
libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)
可能是什么错误?谢谢
import UIKit
class ViewController: UIViewController {
var t = Timer()
@IBAction func hi(_ sender: Any) {
print("Camera button pressed")
t.invalidate()
}
func processTimer() {
print("1 second has passed")
}
override func viewDidLoad() {
super.viewDidLoad()
t = Timer.scheduledTimer(timeInterval: 1, target: self, selector: Selector(("processTimer")), userInfo: nil, repeats: true)
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
问题在于minus10Button
这与许多 IBActions 相关 - 其中一些并不存在。所以右键单击minus10Button
在界面生成器中删除了旧的和不相关的链接,解决了问题。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)