New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

MvxIosViewPresenter NativeModalViewControllerDisappearedOnItsOwn throws exception with PictureChooser #2553

Closed
MatthewSannes opened this Issue Jan 23, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@MatthewSannes

MatthewSannes commented Jan 23, 2018

Steps to reproduce 馃摐

  1. Using PictureChooser within a MvxChildPresentation View

  2. Call PictureChooserTask.ChoosePictureFromLibraryAsync(800, 95);

  3. After selecting picture received the following exception

2018-01-22 21:05:31.921 Hoopster.iOS[4523:245550] Unhandled managed exception:
Sequence contains no elements (System.InvalidOperationException)
at System.Linq.Enumerable.Last[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0000b] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.3/src/mono/external/corefx/src/System.Linq/src/System/Linq/Last.cs:18
at MvvmCross.iOS.Views.Presenters.MvxIosViewPresenter.NativeModalViewControllerDisappearedOnItsOwn () [0x00008] in <6f99728979034e579bc72f6d53e5bc35>:0
at MvvmCross.Plugins.PictureChooser.iOS.MvxImagePickerTask.HandleImagePick (UIKit.UIImage image, System.String name) [0x0013e] in <7bc35bdb0b714bdd9f4e974787e9b1a3>:0
at MvvmCross.Plugins.PictureChooser.iOS.MvxImagePickerTask.Picker_FinishedPickingMedia (System.Object sender, UIKit.UIImagePickerMediaPickedEventArgs e) [0x00045] in <7bc35bdb0b714bdd9f4e974787e9b1a3>:0
at UIKit.UIImagePickerController+_UIImagePickerControllerDelegate.FinishedPickingMedia (UIKit.UIImagePickerController picker, Foundation.NSDictionary info) [0x00014] in /Users/builder/data/lanes/5665/f70a1348/source/xamarin-macios/src/build/ios/native/UIKit/UIImagePickerController.g.cs:855

Expected behavior 馃

No exception

Actual behavior 馃悰

Exception above

Configuration 馃敡

Version: 5.6.3

Platform:

  • 馃摫 iOS
  • 馃 Android
  • 馃弫 WPF
  • 馃寧 UWP
  • 馃崕 MacOS
  • 馃摵 tvOS
  • 馃悞 Xamarin.Forms
@MatthewSannes

This comment has been minimized.

Show comment
Hide comment
@MatthewSannes

MatthewSannes Jan 23, 2018

Was using a custom presenter in order for the PictureChooser to work on previous on a previous version

MatthewSannes commented Jan 23, 2018

Was using a custom presenter in order for the PictureChooser to work on previous on a previous version

@onurhazar

This comment has been minimized.

Show comment
Hide comment
@onurhazar

onurhazar Feb 1, 2018

Hi @MatthewSannes could you please clarify how you solved the issue? we are having the exact problem.

onurhazar commented Feb 1, 2018

Hi @MatthewSannes could you please clarify how you solved the issue? we are having the exact problem.

@MatthewSannes

This comment has been minimized.

Show comment
Hide comment
@MatthewSannes

MatthewSannes Feb 1, 2018

@onurhazar In version 4 I was using a custom presenter to get PictureChooser to work. In version 5 I no longer need to override MvxIosViewPresenter.

In my custom presenter the following method was the culprit.

public override bool PresentModalViewController(UIViewController viewController, bool animated) { if (viewController is UIImagePickerController) { _window.RootViewController.PresentViewController(viewController, animated, null); return true; } else { return base.PresentModalViewController(viewController, animated); } }

MatthewSannes commented Feb 1, 2018

@onurhazar In version 4 I was using a custom presenter to get PictureChooser to work. In version 5 I no longer need to override MvxIosViewPresenter.

In my custom presenter the following method was the culprit.

public override bool PresentModalViewController(UIViewController viewController, bool animated) { if (viewController is UIImagePickerController) { _window.RootViewController.PresentViewController(viewController, animated, null); return true; } else { return base.PresentModalViewController(viewController, animated); } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment