【发布时间】:2021-02-02 02:11:36
【问题描述】:
我正在使用ImageCropper.Forms 包来裁剪图像。它在 android 部分工作正常,但是当我在 ios 上尝试时,我得到以下异常:
异常:>System.MissingMethodException:找不到方法:System.Threading.Tasks.Task`1
Plugin.Media.Abstractions.IMedia.TakePhotoAsync(Plugin.Media.Abstractions.StoreCameraMediaOptions) 在 System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x0002c] 在 /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/系统/运行时/compilerservices/AsyncMethodBuilder.cs:84 在 Stormlion.ImageCropper.ImageCropper.Show (Xamarin.Forms.Page 页面,System.String imageFile) [0x00033] 在 :0 在 ImageCropDemo.MainPage.OnClickedRectangle (System.Object sender, System.EventArgs e) [0x00002] in /Users/companyname/Downloads/ImageCropDemo/ImageCropDemo/ImageCropDemo/MainPage.xaml.cs:29
找到了同样的问题here,但没有解决我的问题。
我的代码
try
{
new ImageCropper()
{
Success = (imageFile) =>
{
Device.BeginInvokeOnMainThread(() =>
{
image.Source = ImageSource.FromFile(imageFile);
});
}
}.Show(this);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("Exception:>" + ex);
}
我尝试安装ImageCropper.Forms.Fix.v3 来解决这个问题。当我尝试安装Fix.v3 时出现以下错误:
严重性代码描述项目文件行抑制状态 错误 NU1101 找不到包 Plugin.Persmissions。源中不存在具有此 ID 的包:Microsoft Visual Studio Offline Packages, nuget.org ImageCropDemo C:\Users\user\Downloads\ImageCropDemo\ImageCropDemo\ImageCropDemo\ImageCropDemo.csproj 1=
错误包还原失败。回滚“ImageCropDemo”的包更改。
ImageCropper.Forms.Fix.v5 安装成功,但异常没有变化。 ImageCropper.Forms.Fix.v6 和ImageCropper.Forms.Fix.v7 包也有,在ios中哪个包可以解决这个问题?
我已经上传了一个示例here 供参考。
【问题讨论】:
标签: ios xamarin.forms