Bug 3711 - UIImagePickerController's delegates
Summary: UIImagePickerController's delegates
Status: CONFIRMED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll (show other bugs)
Version: 5.2
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-03-01 22:42 UTC by Miguel de Icaza [MSFT]
Modified: 2016-02-11 15:06 UTC (History)
4 users (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 for Bug 3711 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description Miguel de Icaza [MSFT] 2012-03-01 22:42:05 UTC
The automatically generated delegates in UIImagePickerController pose a problem.

The class actually detects from Objective-C which selectors have been implemented, in our case, it probes for imagePickerController:didFinishPickingMediaWithInfo: and if it is there, it calls that method instead of calling ImagePickerController:didFinishPickingImage:editingInfo:

The problem that we have is that our approach at implementing all methods in the delegate class leads to methods not being invoked.

The fix is to use Runtime.ConnectMethod for the methods that are actually used, instead.   We could ease this by only landing some of these changes on some classes for now.
Comment 1 Miguel de Icaza [MSFT] 2012-03-01 22:42:54 UTC
Example that fails:

var picker = new UIImagePickerController ();
picker.FinishedPickingImage += delegate {
   // Never called 
};

foo.PresentModalViewController (picker)
Comment 2 Sebastien Pouliot 2012-03-02 09:07:12 UTC
It won't work in every case (not many of them I think) but could we make our own, default, implementation of "imagePickerController:didFinishPickingMediaWithInfo:" call "ImagePickerController:didFinishPickingImage:editingInfo:" ?
Comment 3 Adam Kemp 2015-09-12 17:25:22 UTC
I just ran into this trying to help someone on the forums (https://forums.xamarin.com/discussion/comment/151759#Comment_151759), and it's kind of embarrassing how old this bug report is with no solution. Has Xamarin given up hope on this, or did it just slip through the cracks?
Comment 4 Rolf Bjarne Kvinge [MSFT] 2016-02-11 15:06:08 UTC
We can fix this by overriding RespondsToSelector in the UIImagePickerControllerDelegate class and return 'false' if there are no event handlers attached for a particular method.

This is how we solved the same problem with ABPeoplePickerNavigationController