Ionic: exception with camera after capacitor migration

I migrate my ionic app from cordova to capacitor. When I test camera(with cordova plugin) I have this bug. So I test also with capacitor camera and I have the same bug.

libc++abi: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'main thread only'
terminating with uncaught exception of type NSException

What does your camera JavaScript code look like? Are you using the @capacitor/camera plugin?

Hi @thomasvidas, yes I test with @capacitor/camera.




import { Injectable } from '@angular/core';
import { Camera, CameraResultType, CameraSource, Photo } from '@capacitor/camera';
import { Filesystem, Directory } from '@capacitor/filesystem';
import { Storage } from '@capacitor/storage';

  providedIn: 'root'
export class PhotoService {

  constructor() { }

  public async addNewToGallery() {
    // Take a photo
    const capturedPhoto = await Camera.getPhoto({
      resultType: CameraResultType.Uri,
      source: CameraSource.Camera,
      quality: 100

If you can consistently cause the error, I’d suggest creating a code reproduction and opening an issue on the capacitor plugins GitHub repo. That way the team can reproduce it and fix your issue. Your JavaScript code seems fine to me.

I found solution, I add this to info.plist:

	<string>Here write description why you accessing photo library</string>

and it’s work.