0
votes

When the app crashes, it shows (lldb) in the console. Not exactly sure why it crashes.

But I'm pretty sure it has to do with this function that presents the camera:

let imagePicker: UIImagePickerController! = UIImagePickerController()

func shootADance() {

     if (UIImagePickerController.isSourceTypeAvailable(.camera)) {
        if UIImagePickerController.availableCaptureModes(for: .rear) != nil {

            //if the camera and rear camera is available, dod this

            imagePicker.sourceType = .camera
            imagePicker.mediaTypes = [kUTTypeMovie as String]
            imagePicker.allowsEditing = false
            imagePicker.delegate = self as? UIImagePickerControllerDelegate & UINavigationControllerDelegate

            present(imagePicker, animated: true, completion: nil)
        } else {
            postAlert("Rear camera doesn't exist", message: "Application cannot access the camera.")
        }
    } else {
        postAlert("Camera inaccessable", message: "Application cannot access the camera.")
    }      
}

Here's what comes up in the console

2017-07-25 04:16:02.602 appName[11003:] Firebase Analytics v.3600000 started

2017-07-25 04:16:02.602 appName[11003:] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see blockedLink)

2017-07-25 04:16:02.615: FIRInstanceID AppDelegate proxy enabled, will swizzle app delegate remote notification handlers. To disable add "FirebaseAppDelegateProxyEnabled" to your Info.plist and set it to NO

2017-07-25 04:16:02.653 appName[11003:] Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist

2017-07-25 04:16:02.670 appName[11003:] The AdSupport Framework is not currently linked. Some features will not function properly. Learn more at 2017-07-25 04:16:02.691 Koala[11003:] Firebase Analytics enabled { (lldb)

It appears like there no error message but I know it's the ShootADance function (the source type)

this is what it shows on Xcode when it crashes and shows signal SIGABR

Thank you in advance!

2
If I change .camera to .photolibrary, the app works and it doesn't crash but I want to put .camera because I want the video recording camera to come up, not the photo library.Erik Batista
Have you set the privacy setting for the camera?Aravind A R
did you run it on device or simulator?Vadim Kozak
Now I have put the privacy setting for camera but Xcode still crashes & I'm running from a deviceErik Batista

2 Answers

4
votes

After iOS 10 you have to define and provide camera and microphone usage-descriptions in Info.plist:

Privacy - Microphone Usage Description : $(PRODUCT_NAME) microphone use
Privacy - Camera Usage Description : $(PRODUCT_NAME) camera use
0
votes

Try to create Exception breakpoint, I hope it will help to trace an error.

  1. Tap plus button in footer of breakpoints list
  2. Click Exception breakpoint
  3. Run app and repeat exception case, debugger should to stop on the error line

Tap plus button in footer of breakpoints list

Click Exception breakpoint

Run app and repeat exception case, debugger should to stop on the error line