1 Reply
      Latest reply on Sep 12, 2019 8:23 AM by andriitiutiunnyk
      antobinish Level 1 Level 1 (0 points)

        Following code works good when capturing photo using camera, but app crashes when user taps on video.

         

        let imagePicker = UIImagePickerController()
        imagePicker.modalPresentationStyle = .currentContext
        imagePicker.delegate = self
        if let _ = UIImagePickerController.availableMediaTypes(for: .camera) {
             imagePicker.mediaTypes = UIImagePickerController.availableMediaTypes(for: .camera)!
             if UIImagePickerController.isSourceTypeAvailable(.camera) {
                 imagePicker.sourceType = .camera
                 present(imagePicker, animated: true, completion: nil)
             }
        }