我已按照说明进行操作。 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)。
在iOS中,需要访问Info.plist
和NSCameraUsageDescription
的NSPhotoLibraryUsageDescription
中有密钥才能访问设备的相机和照片/视频库。
例如:
<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>
如果不起作用,您可以在此处共享示例项目链接,我会检查一下。