UIPickerView: unrecognized selector sent to instance - only on ios 3.1.x
-
13-11-2019 - |
سؤال
I have a UIViewController that has a UIPickerView. The picker's datasource and delegate are my controller as you would expect.
My controller implements the UIPickerViewDelegate
and UIPickerViewDataSource
protocols and all the methods that are required:
numberOfComponentsInPickerView
, numberOfRowsInComponent
, titleForRow
and didSelectRow
It's all working well on ios 4 but crashes on 3.1 with a nice "unrecognized selector sent to instance"
as soon as I call [picker reloadInputViews]
(It doesn't even reach breakpoints in the delegate or datasource methods).
I can't see what's missing here (happy to post code is needed)
Many thanks for your help!
المحلول
You should call [picker reloadAllComponents]
. reloadInputViews
is a method of UIResponder
and only available since iOS 3.2. At least according to the documentation. Which you should read.