我只是使用迁移工具将我的Xamarin iOS应用程序迁移到Xamarin Unified。 下面的代码工作正常,应用程序在迁移之前没有任何错误或警告。 迁移后,我收到以下错误 错误1 PresentViewController不接受MediaPickerController对象作为参数。 错误2 mediaPickerController没有DismissViewController方法
protected void TakePicture()
{
MediaPickerController mediaPickerController = mediaPicker.GetTakePhotoUI(new StoreCameraMediaOptions
{
Name = this.PictureName + ".jpg",
DefaultCamera = CameraDevice.Rear
});
if (!mediaPicker.IsCameraAvailable)
{
ShowUnsupported();
}
//Error-1
PresentViewController(mediaPickerController, true, null);
try
{
mediaPickerController.GetResultAsync().ContinueWith(t =>
{
BTProgressHUD.Show("Processing");
// Dismiss the UI yourself
//Error-2
mediaPickerController.DismissViewController(true, () =>
{
if (t.IsCanceled || t.IsFaulted)
{
BTProgressHUD.Dismiss();
return;
}
MediaFile file = t.Result;
FinishedPickingMedia(file);
BTProgressHUD.Dismiss();
});
}, TaskScheduler.FromCurrentSynchronizationContext());
}
catch (Exception ex)
{
Insights.Report(ex, ReportSeverity.Error);
}
}
答案 0 :(得分:0)
从这里https://components.xamarin.com/view/xamarin.mobile下载最新的Xamarin.Mobile dll并引用lib / ios-unified / Xamarin.Mobile.dll而不是旧的dll。 这将解决错误。