Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
2016-11-25 14:06:53.196 testuipickerview[8364:1721535] -[UIPickerViewModel numberOfComponentsInPickerView:]: unrecognized selector sent to instance 0x17eadb80
2016-11-25 14:06:53.200 testuipickerview[8364:1721535] Xamarin.iOS: Received unhandled ObjectiveC exception: NSInvalidArgumentException -[UIPickerViewModel numberOfComponentsInPickerView:]: unrecognized selector sent to instance 0x17eadb80
Steps to reproduce:
1. Create a single page ios application in Xamarin Studio.
2. Add these three lines to the ViewDidLoad method of the ViewController.cs
var view = new UIPickerView();
view.Model = new UIPickerViewModel();
3. Run on ios 9.1 device (I'm running on iPad).
You have to give UIPickerView a data source otherwise iOS does not know how to populate it.
The solution here is to implement IUIPickerViewDataSource, Xamarin Studio should underline it in red to help you add the required methods "GetComponentCount" and "GetRowsInComponent" (press option + space on the interface), you'll then have to return some values of your choice and finally add "view.DataSource = this;"
So with the default SingleView App template you'd get a ViewController.cs like this: https://gist.github.com/VincentDondain/b2e4803d1402451300fdcd2fb8768478