Ios 应用程序在达到断点时崩溃-Swift

Ios 应用程序在达到断点时崩溃-Swift,ios,xcode,swift,breakpoints,Ios,Xcode,Swift,Breakpoints,我运行这个应用程序,它运行得很好。它做了我想让它做的一切。当我点击一个按钮时,它会因为错误而崩溃,线程1 exc\U断点代码=exc\U 1386\U BPT,子代码=0x0 我尝试过的事情: 清理应用程序 构建应用程序 测试应用程序 删除所有@IBOutlets 这是我正在点击的@iAction @IBAction func optionButton(sender: AnyObject) { let actionSheetController: UIAlertController

我运行这个应用程序,它运行得很好。它做了我想让它做的一切。当我点击一个按钮时,它会因为错误而崩溃,线程1 exc\U断点代码=exc\U 1386\U BPT,子代码=0x0

我尝试过的事情:

清理应用程序 构建应用程序 测试应用程序 删除所有@IBOutlets 这是我正在点击的@iAction

@IBAction func optionButton(sender: AnyObject) {
       let actionSheetController: UIAlertController = UIAlertController(title: "You Disliked The Displayed Image", message: "Take Your Own Or Choose From Your Library", preferredStyle: .ActionSheet)

    let cancelAction: UIAlertAction = UIAlertAction(title: "Cancel", style: .Cancel) { action -> Void in
    }

    let takePictureAction: UIAlertAction = UIAlertAction(title: "Take Picture", style: .Default) { action -> Void in
        var takeImage = UIImagePickerController()
        takeImage.delegate = self
        takeImage.sourceType = UIImagePickerControllerSourceType.Camera
        takeImage.allowsEditing = false

        self.presentViewController(takeImage, animated: true, completion: nil)
    }
    let choosePictureAction: UIAlertAction = UIAlertAction(title: "Choose From Camera Roll", style: .Default) { action -> Void in
        var image = UIImagePickerController()
        image.delegate = self
        image.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
        image.allowsEditing = false

        self.presentViewController(image, animated: true, completion: nil)

    }

    actionSheetController.popoverPresentationController?.sourceView = sender as UIView; 
    //Present the AlertController
    self.presentViewController(actionSheetController, animated: true, completion: nil)



    actionSheetController.addAction(choosePictureAction)
    actionSheetController.addAction(takePictureAction)
    actionSheetController.addAction(cancelAction)
}
在显示以下内容的行上发生错误:

actionSheetController.popoverPresentationController?.sourceView = sender as UIView; 
以下是我的viewDidLoad方法:

var ALIMAGES=[image1,image2,image3,image4,image5,image6,image7,image8,image9,image10,image11,image12,image13,image14]

    var imageCount: Int {
        return Int(arc4random_uniform(UInt32(allImages.count)))
    }

    switch imageCount {
    case 1:
        imageView.image = UIImage(named: "IMG_4183")
    case 2:
        imageView.image = UIImage(named: "IMG_4323")
    case 3:
        imageView.image = UIImage(named: "IMG_4325")
    case 4:
        imageView.image = UIImage(named: "IMG_4327")
    case 5:
        imageView.image = UIImage(named: "IMG_4330")
    case 6:
        imageView.image = UIImage(named: "IMG_4331")
    case 7:
        imageView.image = UIImage(named: "IMG_4335")
    case 8:
        imageView.image = UIImage(named: "IMG_4338")
    case 9:
        imageView.image = UIImage(named: "IMG_4394")
    case 10:
        imageView.image = UIImage(named: "IMG_4400")
    case 11:
        imageView.image = UIImage(named: "IMG_4479")
    case 12:
        imageView.image = UIImage(named: "IMG_4508")
    case 13:
        imageView.image = UIImage(named: "IMG_4772")
    case 14:
        imageView.image = UIImage(named: "IMG_4776")
    default:
        println("didn't set image")
    }

我从未见过这种断点错误。有人能帮我解释一下为什么会发生这个错误吗?感谢您的帮助

@BryanChen我应该在代码中更改什么?@BryanChen exc_断点与断点不同。他的应用程序肯定崩溃了。嗯。。。我已经运行了你的optionButton:代码,它对我有效。为什么你认为viewDidLoad:中的代码是相关的?@LyndseyScott我研究过这次崩溃。一些答案告诉我们在viewDidLoad中检查代码并删除所有IBOutlet。