Reputation: 88
I try to simply integrate the image picker in my Tab Page. I have a ion-button which calls the Method chooseImage() on a click.
The Problem ist, that when I start the app in the iOS Simulator, it starts normal, but when I click on the chooseImage Button it crashes in that moment. The Image Picker does not open, it crashes before, directly at the click on the button.... I don't know why. Maybe someone could help me please!
This is the Method:
chooseImage() {
this.options = {
width: 220,
quality: 32,
outputType: 1,
maximumImagesCount: 5
};
this.imageObj = [];
this.imagePicker.getPictures(this.options).then((res) => {
for (var i = 0; i < res.length; i++) {
this.imageObj.push('data:image/jpeg;base64,' + res[i]);
}
}, (error) => {
alert(error);
});
}
Upvotes: 1
Views: 414
Reputation: 1104
Probably you miss NSPhotoLibraryUsageDescription
in your Info.plist
. You should add this:
<key>NSPhotoLibraryUsageDescription</key>
<string>Some description</string>
Where and how add these lines?
This will be helpful if you use cordova
: Add entry to iOS .plist file via Cordova config.xml
If you use capacitor
check documentation.
Upvotes: 1