Error message after switching to a unified API

I just port the Xamarin iOS app to Xamarin Unified using the migration tool. The code below worked fine and the application did not have any errors or warnings before porting. After migration, I got the following errors Error-1 PresentViewController does not accept MediaPickerController as a parameter. Error-2 mediaPickerController does not have a DismissViewController method

        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);
    }
}
+4
source share
1 answer

You need to update the Xamarin component that contains the MediaPickerController to the latest version compatible with Xamarin.iOS single code!

Xamarin.Mobile 0.7.6. , .

0

All Articles