ImageCropper.Forms引发:“未找到方法

问题描述 投票:-1回答:1

我已按照说明进行操作。 MediaPlugin已在所有三个项目中完全安装。现在,我称之为:

        new ImageCropper()
        {
           Success = (imageFile) =>
           {
               Device.BeginInvokeOnMainThread(() =>
               {
                   img.Source = ImageSource.FromFile(imageFile);
               });
           }
        }.Show(this);

但是这会引发错误:

method not found Plugin.Media.Abstractions.IMedia.TakePhotoAsync(Plugin.Media.Abstractions.StoreCameraMediaOptions)'

为什么会这样? (IOS)。

xamarin.forms
1个回答
0
投票

在iOS中,需要访问Info.plistNSCameraUsageDescriptionNSPhotoLibraryUsageDescription中有密钥才能访问设备的相机和照片/视频库。

例如:

<key>NSCameraUsageDescription</key>
<string>This app needs access to the camera to take photos.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app needs access to photos.</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>This app needs access to the photo gallery.</string>

如果不起作用,您可以在此处共享示例项目链接,我会检查一下。

© www.soinside.com 2019 - 2024. All rights reserved.