我是Swift的新手,并且遇到了线程1:信号SIGABRT错误。
预期: 我在主视图控制器页面上的元素上使用滑动导航:左(反射),右(目标)和向上(Insights)。
实际: 预期的左右工作;但是,向上触发SIGABRT错误。
我已经阅读了这个StackOverflow thread,并且似乎没有任何不完整的信息,但是我也不清楚每个触发的segue是否需要伴随的呈现segue,或者如果需要,如何添加正确:
下面是主视图控制器,称为“ ViewController2”
//主要
class ViewController2: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let leftSwipe = UISwipeGestureRecognizer(target: self, action: #selector(swipeAction(swipe:)))
leftSwipe.direction = UISwipeGestureRecognizer.Direction.left
self.view.addGestureRecognizer(leftSwipe)
let rightSwipe = UISwipeGestureRecognizer(target: self, action: #selector(swipeAction(swipe:)))
rightSwipe.direction = UISwipeGestureRecognizer.Direction.right
self.view.addGestureRecognizer(rightSwipe)
let upSwipe = UISwipeGestureRecognizer(target: self, action: #selector(swipeAction(swipe:)))
upSwipe.direction = UISwipeGestureRecognizer.Direction.up
self.view.addGestureRecognizer(upSwipe)
}
这里是 up 视图控制器,称为“ ViewController3”
//洞察力
class ViewController3: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let upSwipe = UISwipeGestureRecognizer(target: self, action: #selector(swipeAction(swipe:)))
upSwipe.direction = UISwipeGestureRecognizer.Direction.up
self.view.addGestureRecognizer(upSwipe)
}
感谢您的建议和帮助!
答案 0 :(得分:0)
修复:我没有将多余的Case 4参数(swipeDown)删除,因为我没有将其用于该主视图控制器。
2018-08-01 23:03:09.779549-0700 Kintsugi Mindful Wellness [63589:12403287] ***由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'Receiver()与标识符'goDown'没有关联'