Ionic 3 Camera Plugin Crashed with saveToPhotoAlbum true on IPhone


#1

Hello everybody, I’m working with Ionic 3 and I’m trying to take a picture and saved it directly into the Gallery.

It works fine for Android but it crashes with iPhone and when I turn saveToPhotoAlbum to false, it works fine, So I realized that the problem is with this option.

I’m using the Docs Code:

#home.ts:



    const options: CameraOptions = {
          quality: 100,
          sourceType: PictureSourceType.CAMERA,
          destinationType: this.camera.DestinationType.DATA_URL,
          encodingType: this.camera.EncodingType.JPEG,
          mediaType: this.camera.MediaType.PICTURE,
          saveToPhotoAlbum:true,
        }
        
        this.camera.getPicture(options).then((imageData) => {
         // imageData is either a base64 encoded string or a file URI
         // If it's base64 (DATA_URL):
         this.selectedImage = 'data:image/jpeg;base64,' + imageData;
        }, (err) => {
         // Handle error
        });

In the Plugin’s Docs, It is recommended to add those line to the:

#config.xml


    </platform>
    
        <edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge">
            <string>need camera access to take pictures</string>
        </edit-config>
        <edit-config target="NSPhotoLibraryUsageDescription" file="*-Info.plist" mode="merge">
            <string>need photo library access to get pictures from there</string>
        </edit-config>
        <edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
            <string>need location access to find things nearby</string>
        </edit-config>
        <edit-config target="NSPhotoLibraryAddUsageDescription" file="*-Info.plist" mode="merge">
            <string>need photo library access to save pictures there</string>
        </edit-config>

for those who have an Iphone If It’s possible, try to make a new project quickly and test it with Ionic AppDev. It’s shameful that a such famous plugin requires a search and a debug for a famous option like saveToPhotoAlbum,

Please I’m Pressed, Who Can Help Me ?