Thread 1: signal SIGABRT error when using IBActions?

坚强是说给别人听的谎言 提交于 2019-12-02 09:32:52

Your code is senseless. You are saying:

actionSheet.addAction(UIAlertAction(title: "Camera roll", style: UIAlertActionStyle.Default, handler: { ( alert: UIAlertAction!) -> Void in
    imagePickerController.sourceType = UIImagePickerControllerSourceType.Camera
    self.presentViewController(imagePickerController, animated: true, completion: nil)
} ))

If the user is going to tap a "Camera roll" button, why would you then create an image picker controller with a Camera source type? That isn't what the user asked for.

The error, by the way, simply means there is no camera. You are not trying to run this code in the Simulator, are you? That would be senseless too. The camera exists only on a device — a device with a camera.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!