Bug 8180 - [Feature] Be able to set the ViewController MediaPicker uses
Summary: [Feature] Be able to set the ViewController MediaPicker uses
Status: RESOLVED FIXED
Alias: None
Product: Mobile API (Preview)
Classification: Xamarin
Component: Xamarin.iOS ()
Version: Preview
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Eric Maupin
URL:
Depends on:
Blocks:
 
Reported: 2012-11-02 11:18 UTC by AndyW
Modified: 2014-01-14 16:53 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description AndyW 2012-11-02 11:18:52 UTC
Be able to set the ViewController that the MediaPicker uses.

Looking at the code it currently does this:

UIWindow keyWindow = UIApplication.SharedApplication.KeyWindow;
UIViewController rootViewController = keyWindow.RootViewController;
MediaPickerDelegate mediaPickerDelegate = new MediaPickerDelegate (rootViewController, sourceType, options);

Which for most cases is fine, but If i try and use PickPhotoAsync on a Modal ViewController I get:
] Warning: Attempt to present <UIImagePickerController: 0x15640d10> on <UINavigationController: 0x14fdbeb0> whose view is not in the window hierarchy!

I propose that eiher a public field is added or an optional constructor that can take a UIViewController, if this is null in private Task<MediaFile> TakeMedia ( .... use the original code.

Thanks

Andy
Comment 1 Eric Maupin 2012-11-02 11:21:46 UTC
Have you updated to the latest version? While presenting still happens automatically, a fix was added in 0.6 so it'll work in more scenarios.
Comment 2 AndyW 2012-11-02 11:26:37 UTC
Ah. No I had not. Updating has fixed the problem. Please close this as invalid. Is there somewhere I can subscribe for update to Xamarin.Mobile?

Thanks

Andy
Comment 3 Eric Maupin 2012-11-02 11:34:21 UTC
We announced the update via twitter (@xamarinhq) and our blog: http://blog.xamarin.com
Comment 4 AndyW 2012-11-02 11:35:39 UTC
Thanks - I do follow you on twitter but I must have missed it :)