I’m looking for clarification as to how someone determines what line of code is causing an error in their app. More specifically, in Chapter 30: Image Picker - pg 712.
Here, we test the app in the simulator, and the camera should open using our new
takePhotoWithCamera() method. However, the app crashes - which the book mentions will happen. It crashes with the following error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Source type 1 not available'
The book immediately explains that the culprit for the crash is the line:
imagePicker.sourceType = .camera
The books then explains that this happens because not all devices have a camera. Fair enough. But my question is how would I as a new developer know that it was that particular line that caused my problem? All I’m directed to is that wildly generic AppDelegate SIGABRT error.
I would love it if someone could shed some light on this.