Open
Description
I ran into an issue when I was using the plugin on iOS. When the picture was taken and I tried to save it to a folder, I got an error saying: error Error: -[DictionaryAdapter _rasterizedImage]: unrecognized selector sent to instance 0x283f1ea90
The code I'm using:
const imageFolder = knownFolders.documents();
console.log('event-data', event.data);
const iosImage = UIImageJPEGRepresentation(event.data, 0.7);
const result1 = NSFileManager.defaultManager.createFileAtPathContentsAttributes(imageFolder.path + "/cam_capture.jpg", iosImage, null);
So I had to change the file index.ios.js to the following:
import { Color, isAndroid, Device, File, ImageAsset, knownFolders, path, Utils, View } from '@nativescript/core';
(import isAndroid)
Then, in the savePhoto
function I changed the const handleSuccess
function to this:
const handleSuccess = () => {
if (!isAndroid) {
this._owner.get().sendEvent(CameraPlus.photoCapturedEvent, this._photoToSave);
} else {
this._owner.get().sendEvent(CameraPlus.photoCapturedEvent, asset);
}
this.resetPreview();
};
This gets rid of the error.
Metadata
Metadata
Assignees
Labels
No labels